Forum > Networking and Web Programming

TFPHttpClient timeout error

<< < (2/3) > >>

TRon:
@jhorta:
must be your setup somewhere because when testing it times-out almost immediate for me.

There are sites to test these kind of things such as JSONPlaceholder and reqbin and I am sure there are many others.

So, your postman also post its requests insecure ?

jhorta:
must be your setup somewhere because when testing it times-out almost immediate for me.
Maybe. Does anyone know of any way to trace the api call to analyze its contents?

So, your postman also post its requests insecure ?
The firewall ask about and i give permission. After that i can see the entry in firewall panel. I added the same permission to my program(Project1.exe). It didn't work

Thaddy:
The full program or a reproducable example...Because in the case of everyone else it works.. >:D
This is really frustrating. I am an old man with time to test..for free..

jhorta:
Here is the complete code, in case you ever have that "philanthropic" moment.

The interface consists of an edit button to show the result and two buttons, one for local access and another to access the same application in the cloud (this one has an SSL problem, which is in another topic on this forum).

The application is an AWS lambda, developed in Python, running locally using the Serverless Framework. I even thought that this could be the problem, but it works normally via Postman.

As you said, it is really frustrating.

To avoid being stuck indefinitely, since I already have the entire backend built, I decided to download Delphi Community. It took me a while to find the correct syntax for TRESTClient, but everything worked well, locally and in the cloud. That gives me a year to try to solve it in FPC.

Cheers.



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, fphttpclient, fpjson, opensslsockets; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    Button2: TButton;    Edit1: TEdit;    procedure Button1Click(Sender: TObject);    procedure Button2Click(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } Function Send(Url : String) : String;Var Client: TFPHttpClient;    Response: TStringStream;Begin   Client := TFPHttpClient.Create(nil);   Client.ConnectTimeout := 6000;   Client.AddHeader('Content-Type', 'application/json');   Client.AddHeader('Accept', 'application/json');   Client.RequestBody := TRawByteStringStream.Create('{"jwt": "", "codAplicacao": "F60EB930-9B1B-11EF-9657-02240D86274B"}');    Response := TStringStream.Create('');    Try      Try         Client.Post(Url, Response);         Result := 'Response: ' + Response.DataString;       Except on E: Exception do          Begin             Result := 'Something wrong: ' + E.Message;          End;       End;   Finally       Client.RequestBody.Free;       Client.Free;       Response.Free;   End;End; procedure TForm1.Button1Click(Sender: TObject);begin   Edit1.Text := Send('https://mystack.execute-api.us-east-2.amazonaws.com/dev/inicio/hortech');end; procedure TForm1.Button2Click(Sender: TObject);begin   Edit1.Text := Send('http://localhost:4000/local/inicio/hortech');end; end. 

Thaddy:
If you do not run a server on localhost, of course you can not test your code.....

That is after testing my conclusion: there is no server.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version