Skip to content

Commit 8232782

Browse files
committed
minor fixes in payload & handling empty body response
1 parent 372f4b0 commit 8232782

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/scripts/test_reports.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ REPORT_STATUS_NOT_AVAILABLE="NOT_AVAILABLE"
77
REPORT_STATUS_TEST_AVAILABLE="TEST_AVAILABLE"
88
REPORT_STATUS_IN_PROGRESS="IN_PROGRESS"
99
REQUESTING_CI="circle-ci"
10-
REPORT_FORMAT="[\"plainText\", \"richHtml\"]"
10+
REPORT_FORMAT='["plainText", "richHtml"]'
1111

1212
# Error scenario mappings
1313
declare -A ERROR_SCENARIOS=(
@@ -39,7 +39,7 @@ make_api_request() {
3939
-D "$header_file" \
4040
-d "{
4141
\"originalBuildName\": \"${BROWSERSTACK_BUILD_NAME}\",
42-
\"buildStartedAt\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\",
42+
\"buildStartedAt\": \"$(date +%s)\",
4343
\"requestingCi\": \"$REQUESTING_CI\",
4444
\"reportFormat\": $REPORT_FORMAT,
4545
\"requestType\": \"$request_type\",
@@ -53,6 +53,10 @@ make_api_request() {
5353

5454
# Clean up the temporary file
5555
rm -f "$header_file"
56+
57+
if [[ -z "$body" ]]; then
58+
body='""'
59+
fi
5660

5761
# Return both status code and body as a JSON object
5862
echo "{\"status_code\": $http_status, \"body\": $body}"

0 commit comments

Comments
 (0)