Android Question httputils2 receive a request with content lenght=0

Discussion in 'Android Questions' started by Siam, May 26, 2015.

  1. Siam

    Siam Active Member Licensed User

    hello,

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

    Code:
    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
     
  2. eurojam

    eurojam Well-Known Member Licensed User

    I would use first the HTTP Lib for this task (http://www.basic4ppc.com/android/help/http.html). Init with the Url of your request and then use StatusCode As Int [read only]. When the Code is 204 there will be no content, which means that you will have an empty result in your httputils2 request.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can use HttpUtils2 source code instead of the library and modify HttpUtils2Service:
    Code:
    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
     
  4. Siam

    Siam Active Member Licensed User

    thank you !!!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice