Mobile APP – Android Volley
-
Hello again,
In my way on using this GREAT plugin for integration on Mobile App (Android), I’m using Volley.I’m making some tests and understanding the way the plugin/API works with PostMan and coding in Android Studio (Java) using Volley library (best practice).
At the moment I’m interested in getting the body answer of POST requests, with correct and incorrect credentials.
ACTUAL FACTS (seen on POSTMAN) :
1. The answer from server is200 OK
only if all credentials are valid. Body is JSON with all we need (details can be configured by plugin = AMAZING !)
2. In all other cases the answer from server is400 Bad Request - The request cannot be fulfilled due to bad syntax.
. Body is JSON with error statement etc…INTEGRATIONS in VOLLEY :
On most libraries concerning HTTP requests, such as Volley…
1. Server answers are seen as SUCCESS / FAILURE based on the returned code of server : 2xx = SUCCESS, 4xx = FAILURE.
2. On failure, the body are not even passed as an answer.PROBLEM :
On wrong credentials, thus 4xx, thus FAILURE… the body is not even passed to the listener, and all we can get is the 4xx code from server… not the JSON body giving the “failure” from Plugin/API.SUGGESTION :
Would it be possible to always have a SUCCESS (2xx) if the request was correctly syntaxed… which it is… and only get a 4xx for real 4xx reasons ?
In this case, with wrong credentials, we could still parse the JSON to identify the correct failure of not getting a token.WORKAROUND :
It is probably possible to get the body from a failed answer 4xx from the server through Volley since PostMan can do it ?? ! I’ll go in this direction for the moment…Best regards, and thank you again for this MASTERPIECE of plugin… and such GREAT SUPPORT !!!!!!!
- The topic ‘Mobile APP – Android Volley’ is closed to new replies.