0

I have a bit nonstandard situation where server sends in case of error responses (500, 404, ..) also json Object inside of response. But I have a problem to get it in Volley. Is there any way how to parse it from headers ?

maxxxo
  • 672
  • 3
  • 10
  • 28

2 Answers2

0

Simple solution is to override parseNetworkResponse in makeStringReq()

Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177
Mattia
  • 124
  • 8
0
  1. HTTP error codes should not have data in the returned response

  2. you can as suggested before, extend Volley's Request and override the parseNetworkResponse and pass on the data if needed or do anything that is reqired.
    p.s. remember that it runs off the UI thread but is blocking a network thread, so you can do heavy parsing but should probably only figure out if this is a success or error and let the rest of the chain take care of parsing.

  3. You can also write your own ErrorListener and figure out what to do upon the different types of errors reponses

thepoosh
  • 12,497
  • 15
  • 73
  • 132