android - May I know how retrofit support 304 Not Modifield? -
anyone know how retrofit support 304 not modifield? because right retrofit throw error. using etag check whether json should update or not.
@get("/imageslist.json") response fetch(@header("if-none-match") string etag); that how handle right now
imageservice service = restadapter.create(imageservice.class); response response = null; try { response = service.fetch("\"venxxg\""); } catch (retrofiterror e) { if (e.getresponse().getstatus() == httpurlconnection.http_not_modified) { //nothing update response = e.getresponse(); } else { log.e("retrofit", e.getmessage(), e); } } is there better way? sorry poor english.
Comments
Post a Comment