Bug? HttpResponse.GetString - either bug in code or in documentation

b4auser1

Well-Known Member
Licensed User
Longtime User
In B4A I used Response.ErrorResponse to get Error response. I didn't find this method in B4i implementation and tried to find an alternative. Could I use Response.GetString instead of Response.ErrorResponse ?

B4X:
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
    Log("Error response: " & Response.GetString & ", status code: " & StatusCode)
    CompleteJob(TaskId, False, Reason, Null)
End Sub

B4X:
/**
* Returns a the server response as a string using UTF8 encoding.
*This method is only valid inside the ResponseSuccess event.
*/
- (NSString *)GetString;
 

b4auser1

Well-Known Member
Licensed User
Longtime User
If I can use Response.GetString instead of Response.ErrorResponse, then
comment "This method is only valid inside the ResponseSuccess event" is incorrect.
otherwise code
Log("Error response: " & Response.GetString & ", status code: " & StatusCode)
is incorrect, because Response.GetString can't be used inside hc_ResponseError.
 

b4auser1

Well-Known Member
Licensed User
Longtime User
So in B4i I should use Reason instead of Response.ErrorResponse in B4A ?
 
Top