question

Martin Brandel avatar image
Martin Brandel asked

Get response headers from http.request in cloudscript?

Where is the documentation for the formatting of the response object to http.request?

This seems like it should be something basic but I can't seem to work out how to find the headers from the response object received when doing an external http request. response.headers is empty.

CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JayZuo avatar image
JayZuo answered

The wrapped http.request in Cloud Script only returns the body of the response, as you've seen (though you can log the full response by setting the logRequestAndResponse parameter to true: http.request(url, httpMethod, content, contentType, headers, true);).

If you want to get the headers from the response. You may try with PlayFab CloudScript using Azure Functions instead of the legacy CloudScript.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rick Chen avatar image
Rick Chen answered

Why do you want to get the headers from the response object in CloudScript? If you want to check the example of making Webhook calls from CloudScript, you can check this document: Making Webhook calls from CloudScript.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Martin Brandel avatar image Martin Brandel commented ·

In this case because I am being re-directed and need to follow the re-direct. Rather than de-coding the html body response I would have preferred to use the header for that.

If that is not possible then some more issues I couldn't find any documentation on: the html document also does not seem to be available, I can't seem to find a way to give the http.request function permission to follow all redirects either. Is there no documentation on what can/cannot be used and how the http.request function actually works and what it returns?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.