Skip to content

Commit

Permalink
update based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Aug 23, 2019
1 parent 2e32b88 commit f336432
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/adapter/addon/json-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import { pluralize } from 'ember-inflector';
const JSONAPIAdapter = RESTAdapter.extend({
defaultSerializer: '-json-api',

defaultContentType: 'application/vnd.api+json',
_defaultContentType: 'application/vnd.api+json',

/**
@method ajaxOptions
Expand Down
6 changes: 4 additions & 2 deletions packages/adapter/addon/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ const hasNajax = typeof najax !== 'undefined';
const RESTAdapter = Adapter.extend(BuildURLMixin, {
defaultSerializer: '-rest',

defaultContentType: 'application/json; charset=utf-8',
_defaultContentType: 'application/json; charset=utf-8',

fastboot: computed(function() {
return getOwner(this).lookup('service:fastboot');
Expand Down Expand Up @@ -1095,7 +1095,7 @@ const RESTAdapter = Adapter.extend(BuildURLMixin, {
options.headers = {};
}

let contentType = options.contentType || this.defaultContentType;
let contentType = options.contentType || this._defaultContentType;

if (get(this, 'useFetch')) {
if (options.data && options.type !== 'GET') {
Expand All @@ -1105,6 +1105,8 @@ const RESTAdapter = Adapter.extend(BuildURLMixin, {
}
options = fetchOptions(options, this);
} else {
// GET requests without a body should not have a content-type header
// and may be unexpected by a server
if (options.data && options.type !== 'GET') {
options = assign(options, { contentType });
}
Expand Down

0 comments on commit f336432

Please sign in to comment.