Android Question httputils2 receive a request with content lenght=0

Siam

Active Member
Licensed User
hello,

I send a Request to an API and if there are no Alerts i will receive this Answer:

B4X:
HTTP/1.1 204 User found but no alerts were found.
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type, Authorization, Accept, Date
Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
Connection: close
Content-Length: 0
My problem is now that i get no answer from httputils2 like job done event.

How can i fix This ?

regards

Andy
 

Erel

Administrator
Staff member
Licensed User
You can use HttpUtils2 source code instead of the library and modify HttpUtils2Service:
B4X:
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
   If Response.ContentLength = 0 Then
     CompleteJob(TaskId, True, "")
   Else
     Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _
       True, TaskId)
   End If
End Sub
 
Top