Hi all,
I am trying to send some binary data using TFPHTTPServer and POST. Here is the snippet of my code:
procedure TMyServer.HandleRequest(var ARequest: TFPHTTPConnectionRequest;
var AResponse: TFPHTTPConnectionResponse);
...
begin
Request := TRequestMessage.Create(AReqeust)
Response := TResponseMessage.Create;
Self.ServeRequest(ARequest, Request, Response);
BinData := '';
Response.SaveAsBinary(BinData);
AResponse.ContentType := 'application/octet-stream';
AResponse.ContentLength:= Length(BinData);
AResponse.Content := BinData;
...
end;
I noticed that the data I send and receive are different. After some more debugging, I figured out that the content of my "BinData" variable and AResponse.Content are different:
For example, if BinData is #10#13#78#111, the value stored in AResponse.Content would be #10#10#78#111.
I wonder if the issue is because of the ContentType? What ContentType should I use?