Skip to content

setRequestHeader behavior doesn't seem to match implementations #108

@bzbarsky

Description

@bzbarsky

If you look at http://w3c-test.org/XMLHttpRequest/setrequestheader-case-insensitive.htm it fails in all of Safari, Chrome, Firefox, and Edge. The test is doing this:

    var client = new XMLHttpRequest()
    client.open("POST", "resources/inspect-headers.py?filter_value=t1,t2,t3", false)
    client.setRequestHeader("x-test", "t1")
    client.setRequestHeader("X-TEST", "t2")
    client.setRequestHeader("X-teST", "t3")
    client.send(null)
    assert_equals(client.responseText, "x-test,")

which asserts that the value of the "x-test" header that was sent to the server is "t1,t2,t3". In Safari, Chrome, Firefox, and Edge the value is "t1, t2, t3" (with spaces after the commas).

This sort of thing has come up before (e.g. whatwg/fetch#422)...

@annevk I don't know whether you want to fix this in XHR or in fetch or whether you think all browsers should change here or what...

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