I’m using network.request like this:
network.request( fullUrl, "POST", networkListener, params)
and receiving the response in my network listener as such:
local function networkListener( event )
if ( event.isError ) then
response = {};
else
response = json.decode(event.response);
end
end
I am receiving the body response of the request but I want to receive the request’s response headers as well. How can I achieve this?
Thanks a lot!
The documentation for network.request
says:
network.request( url, method, listener [, params] )
listener (required)
Listener. The listener function invoked at various phases of the HTTP operation. This is passed a networkRequest event.
And the documentation for networkRequest
links to event.responseHeaders, which gives this example:
-- Print the Content-Type header value for a response
local function networkListener( event )
print( "Content-Type of response is: " .. event.responseHeaders["Content-Type"] )
end