[Solved] how to send application/x-www-form-urlencoded lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- BlueIcaro · 2024-01-17 08:23 Hello, I'm connecting to a server. I have to send a post request using  TFPHTTPClient, with content-type as application/x-www-form- urlencoded. So I wrote: Code: [Select]   PeticionHttp.AddHeader('Content-Type', 'application/x-www-form- urlencoded;v=2.0');   PeticionHttp.AddHeader('Accept', 'application/hal+json;v=2.0');   Respuesta := TStringList.Create();   BodyText := 'resources=1&1=/rw/iosystem/signals/ethernet/board1/do0&1-P=0';   PeticionHttp.RequestBody := TRawByteStringStream.Create;   PeticionHttp.RequestBody.WriteAnsiString(BodyText);   PeticionHttp.Post('https://localhost:80/subscription', Respuesta);  The problem is that the server answers: 400 Bad Request If I make the request using Postman (a small program to test requests) I don´t get any error as you can see in the picture. I think that the problem is that I'm make same mistake in my code. But I don't know what Thanks /BlueIcaro ---------------------------------------------------------------------- BlueIcaro · 2024-01-17 11:26 Hello, I found the solution. The problem was that I don't . So I have to do it on my code. Code: [Select]  Params:='resources=1&1=/rw/iosystem/signals/ethernet/b oard1/do0;state&1-p=0';   PeticionHttp.AddHeader('Content-Type', 'application/x-www-form- urlencoded;v=2.0');   PeticionHttp.AddHeader('Accept', 'application/xhtml+xml;v=2.0');   PeticionHttp.AddHeader('Content-Length',IntToStr(Length(Params))); //We need send the length of the body   PeticionHttp.RequestBody := TRawByteStringStream.Create(Params);   PeticionHttp.Post('https://localhost:80/subscription',Respuesta);  /BlueIcaro