2

How do i get the 304 status code with $http.get ?

$http.get('menu.json').success(function(data, status, headers){
$scope.menu = data;
console.log(status); ## shows 200 but its actually 304 ##
});
lstprgrmr
  • 21
  • 1

1 Answers1

1

You cannot. XMLHttpRequest handles 3xx responses transparently, so the data you get is that of the original (cached) response.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thanks for the reply, clear answer, but do u also know an easy way so i still get my 304 from somewhere with a built in Angular function? Or am i approaching this the wrong way? – lstprgrmr Jul 31 '14 at 14:35
  • The browser doesn't expose the information to JavaScript at all. You cannot get that information. (You *might* be able to figure out something equivalent by examining the Last-Modified header). – Quentin Jul 31 '14 at 14:37