Android Question Http Response headers with HttpUtils2 Library

Ian Garton

Member
Licensed User
Longtime User
Is there a way we can read the response headers when using the HttpUtils2 library?
I'm still having to use the class/service and the HttpUtils2Service.ResponseHeaders map.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Change hc_ResponseSuccess to:
B4X:
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
   Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _
     True, TaskId)
   Dim job As HttpJob = TaskIdToJob.Get(TaskId)
   job.Tag = Response.GetHeaders
End Sub
Now you will be able to get the headers in JobDone with this code:
B4X:
Dim headers As Map = job.Tag
 
Upvote 0

lorebarita

Member
Licensed User
Longtime User
Hi Erel. I have been looking for such a solution but I get the following error

Parsing code. 0.64
Compiling code. Error
Error compiling program.
Error description: Unknown member: tag
Occurred on line: 49
job.Tag = Response.GetHeaders
Word: tag

I have spent soo much time finding a solution but I need your help
 
Upvote 0

Ian Garton

Member
Licensed User
Longtime User
Thanks Erel, this is what I'm doing using the class module and service.
I was just wondering if there was a way of getting the headers using the library instead.
 
Upvote 0
Top