国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - axios setting custom request header problem
淡淡煙草味
淡淡煙草味 2017-05-24 11:38:23
0
1
775

Don’t criticize me yet. I have read the document and searched on Google. The results set by the document or the answers found are not what I want. The main.js code is as follows

axios.interceptors.request.use(
    config => {
          // 判斷是否存在token,如果存在的話,則每個(gè)http header都加上token
        // config.withCredentials = true
        config.headers['X-Token'] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkuamlhamlh'
        
        return config
    },
    err => {
        return Promise.reject(err)
})

The results output by the browser are as follows

There is just one more Access-Control-Request-Headers:x-token
There is not even the value of x-token. There should not be one more X-Token in the header information, which is the same level as "Host" properties?
Shouldn’t be

Solution

淡淡煙草味
淡淡煙草味

reply all(1)
洪濤

That’s it, it’s a cross-domain request, not a simple request (it’s not a get、post 或存在多余的頭部)時(shí),瀏覽器會(huì)首先進(jìn)行一個(gè) OPTIONS 請(qǐng)求,這個(gè)請(qǐng)求來詢問跨域是否被允許。Access-Control-Request-Headers request.

When the server returns permission Access-Control-Request-* 所列出的項(xiàng)目是(就是返回 Access-Control-Allow-*), the browser will send your request.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template