8000 Request headers · Issue #610 · turbolinks/turbolinks · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Sep 25, 2021. It is now read-only.
This repository was archived by the owner on Sep 25, 2021. It is now read-only.
Request headers #610
Open
Open
@ghost

Description

The documentation says that I can add a header to the request

  var xhr = event.data.xhr
  xhr.setRequestHeader("X-Request-Id", "123...")

But it doesn't work, I get an error:
DOMException: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.
Which makes sense.

Of course I can open a connection and specify the required settings, something like

            let xhr = event.data.xhr;
            xhr.open('GET', event.data.url, true);
            xhr.setRequestHeader("Authorization", "Bearer " + token);
            xhr.send();

but in this case, when I navigate through the pages, I will constantly send the old requests and immediately get interrupted.

Is there a solution to this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0