jeswin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017
02:21 AM
GetHeaders from roUrlTransfer
Hi,
I need to get the header values using roUrlTransfer, is it possible?
the above code will return the result from the api i have called, but i want to get the header values of this response.
I need to get the header values using roUrlTransfer, is it possible?
serverAPI = createObject("roUrlTransfer")
serverAPI.setUrl(api_url)
reqHeaders = serverAPI.GetToString()
the above code will return the result from the api i have called, but i want to get the header values of this response.
6 REPLIES 6
Aleksandr_Sam
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017
04:54 AM
Re: GetHeaders from roUrlTransfer
jeswin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017
05:25 AM
Re: GetHeaders from roUrlTransfer
Yes i have already tried with the following code
It waits not running after that, also if i giv timeout its running but not returning anything.
Any example
serverAPI = createObject("roUrlTransfer")
serverAPI.setUrl(api_url)
xport=CreateObject("RoMessagePort")
serverAPI.setport(xport)
msg=wait(0,xport)
if type(msg) = "roUrlEvent"
hedtwo=msg.GetResponseHeaders()
print hedtwo
end if
It waits not running after that, also if i giv timeout its running but not returning anything.
Any example
Aleksandr_Sam
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017
08:04 AM
Re: GetHeaders from roUrlTransfer
Your code is right.
You must catch the headers
You must catch the headers

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017
10:13 AM
Re: GetHeaders from roUrlTransfer
You need to call AsyncGetToString before doing the wait.
--Mark
--Mark
jeswin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2017
08:02 PM
Re: GetHeaders from roUrlTransfer
Yes tried,
it returns true but still it waits after that for a long time and nothing runs after that
it returns true but still it waits after that for a long time and nothing runs after that
Sherry10
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023
10:18 PM
Re: GetHeaders from roUrlTransfer
I know it is pretty late but leaving it here in case someone else comes along the same issue.
GetResponseHeaders() returns the headers if status code of response is between 200 and 300. Maybe that is why you did not see any response headers because your response code was out of these bounds.
If that is the case, you may need to use GetResponseHeadersArray(), according to the docs it returns all headers regardless of the status code.