Skip to content

Commit 8d0ef7e

Browse files
committed
[httpClient] Check if json response content
1 parent 915da47 commit 8d0ef7e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Quick.HttpClient.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ constructor THttpRequestResponse.Create(aResponse: IHTTPResponse; const aContent
380380
begin
381381
fStatusCode := aResponse.StatusCode;
382382
fStatusText := aResponse.StatusText;
383-
if aContent <> '' then fResponse := TJSONObject.ParseJSONValue(aContent) as TJSONObject;
383+
if ((aContent <> '') and
384+
(aContent.StartsWith('{') or (aContent.StartsWith('[')))
385+
) then fResponse := TJSONObject.ParseJSONValue(aContent) as TJSONObject;
384386
//if response is not json, get as json result
385387
if fResponse = nil then
386388
begin

0 commit comments

Comments
 (0)