Skip to content

Headers object's guard (request-no-CORS) #9

@horo-t

Description

@horo-t

I'm implementing Request class in Chromium.
While I'm writing test codes like the following, I noticed a problem.

var baseRequest = new Request('test.html', {headers: {'X-Test': 'test'}});
var request = new Request(baseRequest, {mode: 'no-cors'});
console.log(request.headers.get('X-Test'))  // -> 'test'

This request.headers should not have 'X-Test' header, because the mode is no-cors and 'X-Test' is not a simple header.

http://fetch.spec.whatwg.org/#request-class
The Request(input, init) constructor must run these steps:
...
If r's request's mode is no CORS, run these substeps:

  1. If r's request's method is not a simple method, throw a TypeError.
  2. Set r's Headers object's guard to request-no-CORS.

I think we should remove non simple headers here.

Is my understanding correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions