custom headers are not added to Request object

前端 未结 1 1563
深忆病人
深忆病人 2021-01-20 03:36

I\'m trying to use fetch api.

First i create a new Headers() object:

var oHeaders = new Headers({
    \'Accept\': \'applic         


        
1条回答
  •  醉梦人生
    2021-01-20 04:08

    When you set mode: 'no-cors'for a request, browsers won’t allow you to set any request headers other than CORS-safelisted request-headers. See the spec requirements:

    To append a name/value (name/value) pair to a Headers object (headers), run these steps:

    1. Otherwise, if guard is "request-no-cors" and name/value is not a CORS-safelisted request-header, return.

    In that algorithm, return equates to “return without adding that header to the Headers object”.

    0 讨论(0)
提交回复
热议问题