Reputation: 33
I using curl testing and it return 304 Not Modified.
curl -i -H "If-None-Match: \"df3c2a09938aa3c0cfdb945a41a5c2430e3832b6\"" "https://graph.facebook.com/v2.4/me/adaccounts?access_token=******************************"
This is response from server:
HTTP/1.1 304 Not Modified
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=UTF-8
X-FB-Trace-ID: Ef0W7CPfAwo
X-FB-Rev: 1907442
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate
Facebook-API-Version: v2.4
Expires: Sat, 01 Jan 2000 00:00:00 GMT
X-FB-Debug: tGY11aw+eMAejPHXFtD4REFwgwzFR6GLrVvwl6f5aeZsVVwq+AGSa2i5TOfk8C7523h+
0S6M3TOTOK94ABIZ4w==
Date: Fri, 28 Aug 2015 03:07:59 GMT
Connection: keep-alive
Content-Length: 0
But in java I using below code but it doesn't return 304 Not Modified
URL sourceURL = new URL("https://graph.facebook.com/v2.4/me/adaccounts?access_token=************************");
HttpURLConnection sourceConnection = (HttpURLConnection) sourceURL.openConnection();
sourceConnection.addRequestProperty("If-None-Match", "df3c2a09938aa3c0cfdb945a41a5c2430e3832b6");
sourceConnection.connect();
This is response from server :
null:HTTP/1.1 200 OK
ETag:"df3c2a09938aa3c0cfdb945a41a5c2430e3832b6"
Content-Length:342
Expires:Sat, 01 Jan 2000 00:00:00 GMT
Connection:keep-alive
Cache-Control:private, no-cache, no-store, must-revalidate
Pragma:no-cache
X-FB-Debug:BDqNs5aELmixSyTcDnmFGio4veU494IJh7/mlAxzfVX705e2cmNwtswGYp38XOyfL6gAOS1ZyvAWdl25k0Nx/g==
Access-Control-Allow-Origin:*
Date:Fri, 28 Aug 2015 03:08:49 GMT
Facebook-API-Version:v2.4
X-FB-Trace-ID:C9BsIg/gIFq
Content-Type:application/json; charset=UTF-8
X-FB-Rev:1907442
Can anybody tell me reason? Thank a lot.
Upvotes: 3
Views: 620
Reputation: 19682
Entity Tag needs to be quoted :)
response
ETag: "df3c2a09938aa3c0cfdb945a41a5c2430e3832b6"
request
If-None-Match: "df3c2a09938aa3c0cfdb945a41a5c2430e3832b6"
The request header you set is not quoted:)
Upvotes: 1