API需要设置用户代理,但在chrome中不安全的标头

问题描述 投票:1回答:1

我一直试图从Shoppy API请求信息,而我在chrome和Opera上得到的响应是这个

this

在Shoppy API文档中,它要求设置一个用户代理,这对我来说是无法通过查看堆栈溢出帖子来理解的。但是,我想知道的问题是是否有解决方法?

sidenote:使用firefox,我从启用了CORS扩展的API成功获得了响应。

shoppy api documentation

mounted () {
 axios
  .get('https://shoppy.gg/api/v1/products/', {
    headers: {
      'Authorization': 'placeholder',
      'Access-Control-Allow-Origin': 'https://shoppy.gg',
      useCredentails: true, 'user-agent': 'Shoppy'}})
  .then(res => console.log(res))
  .catch(err => console.log(err));
  // .then(response => (this.info = response))

}
vue.js axios user-agent
1个回答
1
投票

[如果您通过非浏览器客户端应用程序使用用户代理,则只需担心设置用户代理。如果您通过浏览器在网站上使用他们的API,那么浏览器的用户代理将自动使用,而您无需执行任何操作。

© www.soinside.com 2019 - 2024. All rights reserved.