Man*_*nel 6 javascript cors fetch-api
我正在使用javascript fetch API使用以下代码查询跨域api:
fetch('https://api.com/search?query="2016"').then(function (response) {
console.log(response.headers.get('Access-Control-Allow-Headers'))
console.log(response.headers.get('Content-Range'))
console.log(response.headers.get('Accept-Range'))
console.log(response.headers.get('Date'))
console.log(response.headers.get('Content-Type'))
})
Run Code Online (Sandbox Code Playgroud)
响应标头如下:
Accept-Range:cars 300
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Content-Range, Accept-Range
Access-Control-Allow-Methods:PUT, POST, OPTIONS, GET
Access-Control-Allow-Origin:*
Cache-Control:no-cache
Connection:keep-alive
Content-Range:0-99/1941
Content-Type:application/json
Date:Tue, 12 Jan 2016 12:17:55 GMT
Transfer-Encoding:chunked
Run Code Online (Sandbox Code Playgroud)
非常奇怪的是,只有"Content-Type"适用于其他我得到null:
null
null
null
null
application/json
Run Code Online (Sandbox Code Playgroud)
我需要做什么来检索那些空标题?
| 归档时间: |
|
| 查看次数: |
2556 次 |
| 最近记录: |