为什么mapboxgl api返回304状态代码? [英] Why mapboxgl api returns 304 status code?

查看:51
本文介绍了为什么mapboxgl api返回304状态代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IOS应用程序中获取针对地图框api请求的http代码304状态代码.但是它可以在Chrome,Safari,Firefox等浏览器中使用200条代码.也可以在Android中使用.

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"

推荐答案

304状态代码保持未修改"状态,表示设备(例如浏览器或IOS应用)识别出已存在的内容.这意味着它已被缓存,可以从那里进行服务,而无需再次下载.状态304并不是坏事"或错误",就像您在问题中描述的那样.

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.

我想您在IOS应用程序中会得到304,因为您没有禁用缓存,而在浏览器开发人员工具中,您可能只是勾选了禁用缓存"框.然后,您将始终获得最新的200条回复.如果您取消选中此框,那么您还会在该处看到状态304

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

您可能想在这里更深入地了解一下: https://httpstatuses.com/304

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

这篇关于为什么mapboxgl api返回304状态代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆