summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/http.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/main/http.c b/main/http.c
index 0e45b60db..e2982a73b 100644
--- a/main/http.c
+++ b/main/http.c
@@ -880,12 +880,16 @@ struct ast_json *ast_http_get_json(
}
buf = ast_http_get_contents(&content_length, ser, headers);
- if (buf == NULL)
- {
+ if (buf == NULL) {
/* errno already set */
return NULL;
}
+ if (!content_length) {
+ /* it is not an error to have zero content */
+ return NULL;
+ }
+
body = ast_json_load_buf(buf, content_length, NULL);
if (body == NULL) {
/* Failed to parse JSON; treat as an I/O error */