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

b4auser1

Well-Known Member
Licensed 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;
 

Erel

Administrator
Staff member
Licensed User
Not sure that I understand. Is this a bug report or a question?
 

b4auser1

Well-Known Member
Licensed 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.
 

Erel

Administrator
Staff member
Licensed User
I see. The log command should be: Log("ResponseError: " & Reason & ", status code: " & StatusCode)
 
Top