HTTP Request's response is missing headers the API is responding with

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Raheel

I’m making an HTTPRequest to an API and getting back a response. I get the correct response body in the callback function, but I don’t get all the headers the API is sending. When I try making the same request using Postman, I get all the headers I’m supposed to get.

Following is the code snippet I’m using:

Get(string endpoint, Object callbackTarget, string callbackMethod, string name, Godot.Collections.Array binds, List<string> headers, int timeOutDuration)
 {
    var request = new HTTPRequest { Name = name, Timeout = timeOutDuration};
    AddChild(request);
    request.Connect("request_completed", callbackTarget, callbackMethod, binds);
    var error = request.RequestRaw(url, headers, true, HTTPClient.Method.Get);
}

Probably helpful to post your request_completed handler. One of its parameters contains the headers.

spaceyjase | 2023-04-11 14:31

:bust_in_silhouette: Reply From: Raheel

This was my mistake. The API was sending different headers for each endpoint. The headers behave as they should.