hello,
I'm sending data using THttpClient with content-type application / x-www-form-urlencoded. In one of the data parameters there is a comma symbol character. this results in a Bad request. Please inform to send the correct data if referring to my code, the following parameter name contains commas.
FClient := THttpClient.Create;
FClient.OnSendingRequest := procedure(Req: THttpRequest)
begin
Req.Headers.SetValue('content-type', 'application/x-www-form-urlencoded');
Req.Headers.SetValue('authorization',
TSparkleUtils.BasicAuthHeaderValue(key, pass));
end;
Req := FClient.CreateRequest;
try
//set request method
ext_id := 'yyywgtd56';
name_cust := 'Wart, Hext, Gorm';
Req.Method := 'POST';
//set uri
Req.Uri := Url_Client + PathClient;
//set data
sData := 'ext_id='+ext_id+'&name_cust='+name_cust;
Req.SetContent(TEncoding.UTF8.GetBytes(sData));
Resp := FClient.Send(Req);
//fill response
Result := TEncoding.UTF8.GetString(Resp.ContentAsBytes);
finally
Req.Free;
Resp.Free;
FClient .Free;
end;