Hi, Guys
I have a problem with this code
Basically, if the API call returns status code = 200 - job.Success = true and job.response.StatusCode = 200 and it works great.
However, if the API call returns status code = 204, then job.Success = false then job.response.StatusCode = -1, and I end up with error message (as it drops thro' to the Else statement).
"An error occurred with the HTTP job: okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR"
I need to detect a 204 response, can anyone help (Note: Same code snippet works in B4i) - also I have selected OkHttp and OkHttpUtils2 libraries.
Regards
Dave
I have a problem with this code
Http code:
Dim urlString As String = modEposWeb.URL_COMMS_API & "?msgSrcDst=0¢reID=" & myData.centre.centreID & "&customerId=" & customerId
job.PutString(urlString, tempMsg)
job.GetRequest.SetContentType("application/json;charset=UTF-8")
Wait For (job) JobDone(job As HttpJob)
If job.Success And job.Response.StatusCode = 200 Then
' ToastMessageShow("Comms message sent to Web Server.", True)
Else If job.Success And job.Response.StatusCode = 204 Then
ToastMessageShow("Message REJECTED - Centre Closed", True)
Else ' An error of some sort occurred
Dim errorMsg As String = "An error occurred with the HTTP job: " & job.ErrorMessage
ToastMessageShow(errorMsg, True)
End If
statusCode = job.Response.StatusCode
job.Release ' Must always be called after the job is complete, to free its resources
Basically, if the API call returns status code = 200 - job.Success = true and job.response.StatusCode = 200 and it works great.
However, if the API call returns status code = 204, then job.Success = false then job.response.StatusCode = -1, and I end up with error message (as it drops thro' to the Else statement).
"An error occurred with the HTTP job: okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR"
I need to detect a 204 response, can anyone help (Note: Same code snippet works in B4i) - also I have selected OkHttp and OkHttpUtils2 libraries.
Regards
Dave