为什么mapboxgl api返回304状态代码?

编程入门 行业动态 更新时间:2024-10-28 21:26:29
本文介绍了为什么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.

api.mapbox/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

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

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

更多推荐

为什么mapboxgl api返回304状态代码?

本文发布于:2023-11-24 18:06:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626282.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   代码   mapboxgl   api

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!