Skip to content

Set Accept header for XHR requests #540

Closed
@candrews

Description

@candrews

When making XHR requests, can you please set the Accept header? It's currently not set, meaning it defaults to *

Server side frameworks use the Accept header to determine how a request should be handled. For example, Spring Security will return HTTP 401 instead of redirecting to a login page is authentication is required.

I believe that these should be the values for the requests:

  • /info should have Accept: application/json
  • /xhr should have Accept: application/json
  • /xhr_send should have Accept: text/plain
  • /xhr_streaming should have Accept: application/javascript
  • /eventsource should have Accept: text/event-stream

In some cases, it's not possible to do set the Accept header (such as when using XDomainRequest, iframes, or jsonp). But it should be set appropriately whenever it is possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions