Jump to content

HTTP Post With Indy Error "Conection Closed Gracefully"


n3o

Recommended Posts

Hi,

 

I'm using unigui with indy and want to send data through http post, but I got error "Connection Closed Gracefully", how to resolve that?

 

here my code :

 

function TUniMainModule.HttpRequestEx(AMethod: THTTPMethod; AUrl, ABody,
  ACustomHeader: string): TJSONValue;
var
  _ret: string;
  _sl: TStringList;
begin
  _sl := TStringList.Create;
  try
    _http.Request.CustomHeaders.FoldLines := False;
    if ACustomHeader <> '' then
      _http.Request.CustomHeaders.Text := Trim(ACustomHeader)
    else
      _http.Request.CustomHeaders.Add(Format('AUTH-TOKEN=%s',[TokenKey]));


    _sl.Text := ABody;
    _ret := _http.Post(AUrl,_sl);


    Result := TJSONUtils.StringToObject(_ret)


  finally
    FreeAndNil(_sl);
  end;


end;
 
 
Thank.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...