Recent

Author Topic: "Error reading Data from Socket" if FPHttpClient response exceeds certain size  (Read 1441 times)

lazquest

  • Newbie
  • Posts: 1
I use the following script to request data from an API. This works fine, but only if the response does not exceed a certain size (~200 lines), otherwise I get an "Error reading Data from Socket" exception back. Anybody got an idea?

UPDATE:
I tried Indy's idhttp, it works fine here. So it is not because of an API error, the server or something else.


 
Code: [Select]
url := APIUrl+'/positions';  //HTTPS-URL
  GetJson := TJSONObject.Create;
  With TFPHttpClient.Create(Nil) do
  try
    AddHeader('Content-Type', 'application/json; charset=UTF-8');
    AddHeader('Accept', 'application/json; charset=UTF-8');
    AddHeader('VERSION', '2');
    AddHeader('X-API-KEY', APIKey);
    AddHeader('X-SECURITY-TOKEN',token);
    AddHeader('CST', cst);
    RequestBody := TStringStream.Create(GetJson.AsJSON);
    responseData := Get(url);

  finally
   Free;
  end;
  memo1.lines.text:=responseData;     

 
   
 
« Last Edit: July 21, 2020, 07:31:50 pm by lazquest »

 

TinyPortal © 2005-2018