Search code examples
mapboxmapbox-gl-jsmapbox-glmapbox-markermapbox-android

Why mapboxgl api returns 304 status code?


I am getting http code 304 status code for the map box api request in IOS application. But it works in browsers such as Chrome, Safari, Firefox getting 200 code. Also works in Android.

https://api.mapbox.com/styles/v1/mapbox/streets-v9?access_token="my token"

Solution

  • The 304 status code stays for "not modified" meaning that the device (e.g. a browser or your IOS app) recognizes the content as already present. This means that it is cached and can be served from there and does not need to be downloaded again. Status 304 is not "a bad thing" or "wrong", like you describe it in your question.

    I guess you get 304 in your IOS app because you don't have caching disabled where as in your browser developer tools you might have just ticked the "Disable Cache" box. Then you will always get fresh and new 200 responses. If you would uncheck the box you will also see status 304 there too

    enter image description here

    You might wanna take a more in depth look here: https://httpstatuses.com/304