Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default content type to text/plain;charset=UTF-8 with ajaxConfig #78

Closed
yamsellem opened this issue Jun 3, 2016 · 2 comments
Closed

Comments

@yamsellem
Copy link

yamsellem commented Jun 3, 2016

Is there a reason why body are send by default with a Content-Type to text/plain;charset=UTF-8?
This is very painful.

Ok, this is on my side too.
Using ajaxConfig is the reason of this, but I can't find why.

ajaxConfig: {
  beforeSend: function(xhr) {
    xhr.open(this.type, this.url + `?token=...`, true);
  },
@yamsellem yamsellem changed the title Default content type to text/plain;charset=UTF-8 Default content type to text/plain;charset=UTF-8 with ajaxConfig Jun 3, 2016
@yamsellem
Copy link
Author

Not related to ampersand-model.
I'll post the solution here when I find it.

@yamsellem
Copy link
Author

This is enough to fix the problem;

ajaxConfig: {
  beforeSend: function(xhr) {
    xhr.open(this.type, this.url + `?token=...`, true);
    Object.keys(xhr.headers).forEach(header => {
      xhr.setRequestHeader(header, xhr.headers[header]);
    });
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant