How can i access HTTP header fields like ETag from a response using Volley ?
With HttpUrlCoonection
i just do conn.getHeaderField("ETag")
and that's it.
Thanks
How can i access HTTP header fields like ETag from a response using Volley ?
With HttpUrlCoonection
i just do conn.getHeaderField("ETag")
and that's it.
Thanks
You can extend
Request
class. Then when you implementparseNetworkResponse(NetworkResponse response)
method you can access header values inresponse.headers
. So you can access ETag header likeresponse.headers.get("ETag")
. What I did was to then add this header value in response object likeresponse.setETag(etag)
and than I just return it inResponse.success(response, null)
. Response object will then be delivered todeliverResponse(E response)
where you can send it forward to some listener.You can subclass
Request
(or any of its subclasses) and override theparseNetworkResponse
method: