Skip to content

Incorrect content-type sent with latest version of ember-data (3.9.0) #57

@KroneckerDeIta

Description

@KroneckerDeIta

ember-data-hal-9000 version: 0.3.3
ember-data version: 3.9.0

With ember-data version 3.8.0 the correct content-type is sent with a POST request, in particular application/hal+json, however, upgrading ember-data to 3.9.0 causes the content-type to be application/vnd.api+json.

We set the headers ourselves in the HalAdapter by doing

It looks like the ember-data guys have made a change so that the ajaxOptions method now sets the contentType to be application/vnd.api+json.

The workaround in my own code for this is to override ajaxOptions in each of my adapters to be:

/** * Overrides the AJAX options. */ ajaxOptions() { const hash = this._super(...arguments); hash.headers['content-type'] = "application/hal+json"; hash.headers['Accept'] = "application/hal+json"; return hash; },

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