Skip to content

Commit

Permalink
chore(all): prepare release 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 30, 2018
1 parent 24f06a6 commit 07d7196
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 39 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-fetch-client",
"version": "1.3.0",
"version": "1.3.1",
"description": "A simple client based on the Fetch standard.",
"keywords": [
"aurelia",
Expand Down
22 changes: 16 additions & 6 deletions dist/amd/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ define(['exports'], function (exports) {
if (typeof fetch === 'undefined') {
throw new Error('HttpClient requires a Fetch API implementation, but the current environment doesn\'t support it. You may need to load a polyfill such as https://github.com/github/fetch');
}

this.defaults = {
headers: { 'content-type': 'application/json' }
};
}

HttpClient.prototype.configure = function configure(config) {
Expand Down Expand Up @@ -200,8 +196,12 @@ define(['exports'], function (exports) {
requestContentType = new Headers(requestInit.headers).get('Content-Type');
request = new Request(getRequestUrl(this.baseUrl, input), requestInit);
}
if (!requestContentType && new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
if (!requestContentType) {
if (new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
} else if (body && isJSON(body)) {
request.headers.set('Content-Type', 'application/json');
}
}
setDefaultHeaders(request.headers, parsedDefaultHeaders);
if (body && Blob.prototype.isPrototypeOf(body) && body.type) {
Expand Down Expand Up @@ -251,6 +251,16 @@ define(['exports'], function (exports) {
}, Promise.resolve(input));
}

function isJSON(str) {
try {
JSON.parse(str);
} catch (err) {
return false;
}

return true;
}

function identity(x) {
return x;
}
Expand Down
23 changes: 16 additions & 7 deletions dist/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,6 @@ export class HttpClient {
if (typeof fetch === 'undefined') {
throw new Error('HttpClient requires a Fetch API implementation, but the current environment doesn\'t support it. You may need to load a polyfill such as https://github.com/github/fetch');
}

// Use application/json as the default content-type.
this.defaults = {
headers: { 'content-type': 'application/json' }
};
}

/**
Expand Down Expand Up @@ -379,8 +374,12 @@ function buildRequest(input, init) {
requestContentType = new Headers(requestInit.headers).get('Content-Type');
request = new Request(getRequestUrl(this.baseUrl, input), requestInit);
}
if (!requestContentType && new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
if (!requestContentType) {
if (new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
} else if (body && isJSON(body)) {
request.headers.set('Content-Type', 'application/json');
}
}
setDefaultHeaders(request.headers, parsedDefaultHeaders);
if (body && Blob.prototype.isPrototypeOf(body) && body.type) {
Expand Down Expand Up @@ -427,6 +426,16 @@ function applyInterceptors(input, interceptors, successName, errorName, ...inter
}, Promise.resolve(input));
}

function isJSON(str) {
try {
JSON.parse(str);
} catch (err) {
return false;
}

return true;
}

function identity(x) {
return x;
}
Expand Down
22 changes: 16 additions & 6 deletions dist/commonjs/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ var HttpClient = exports.HttpClient = function () {
if (typeof fetch === 'undefined') {
throw new Error('HttpClient requires a Fetch API implementation, but the current environment doesn\'t support it. You may need to load a polyfill such as https://github.com/github/fetch');
}

this.defaults = {
headers: { 'content-type': 'application/json' }
};
}

HttpClient.prototype.configure = function configure(config) {
Expand Down Expand Up @@ -196,8 +192,12 @@ function buildRequest(input, init) {
requestContentType = new Headers(requestInit.headers).get('Content-Type');
request = new Request(getRequestUrl(this.baseUrl, input), requestInit);
}
if (!requestContentType && new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
if (!requestContentType) {
if (new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
} else if (body && isJSON(body)) {
request.headers.set('Content-Type', 'application/json');
}
}
setDefaultHeaders(request.headers, parsedDefaultHeaders);
if (body && Blob.prototype.isPrototypeOf(body) && body.type) {
Expand Down Expand Up @@ -247,6 +247,16 @@ function applyInterceptors(input, interceptors, successName, errorName) {
}, Promise.resolve(input));
}

function isJSON(str) {
try {
JSON.parse(str);
} catch (err) {
return false;
}

return true;
}

function identity(x) {
return x;
}
Expand Down
22 changes: 16 additions & 6 deletions dist/es2015/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ export let HttpClient = class HttpClient {
if (typeof fetch === 'undefined') {
throw new Error('HttpClient requires a Fetch API implementation, but the current environment doesn\'t support it. You may need to load a polyfill such as https://github.com/github/fetch');
}

this.defaults = {
headers: { 'content-type': 'application/json' }
};
}

configure(config) {
Expand Down Expand Up @@ -161,8 +157,12 @@ function buildRequest(input, init) {
requestContentType = new Headers(requestInit.headers).get('Content-Type');
request = new Request(getRequestUrl(this.baseUrl, input), requestInit);
}
if (!requestContentType && new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
if (!requestContentType) {
if (new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
} else if (body && isJSON(body)) {
request.headers.set('Content-Type', 'application/json');
}
}
setDefaultHeaders(request.headers, parsedDefaultHeaders);
if (body && Blob.prototype.isPrototypeOf(body) && body.type) {
Expand Down Expand Up @@ -204,6 +204,16 @@ function applyInterceptors(input, interceptors, successName, errorName, ...inter
}, Promise.resolve(input));
}

function isJSON(str) {
try {
JSON.parse(str);
} catch (err) {
return false;
}

return true;
}

function identity(x) {
return x;
}
Expand Down
22 changes: 16 additions & 6 deletions dist/native-modules/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ export var HttpClient = function () {
if (typeof fetch === 'undefined') {
throw new Error('HttpClient requires a Fetch API implementation, but the current environment doesn\'t support it. You may need to load a polyfill such as https://github.com/github/fetch');
}

this.defaults = {
headers: { 'content-type': 'application/json' }
};
}

HttpClient.prototype.configure = function configure(config) {
Expand Down Expand Up @@ -188,8 +184,12 @@ function buildRequest(input, init) {
requestContentType = new Headers(requestInit.headers).get('Content-Type');
request = new Request(getRequestUrl(this.baseUrl, input), requestInit);
}
if (!requestContentType && new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
if (!requestContentType) {
if (new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
} else if (body && isJSON(body)) {
request.headers.set('Content-Type', 'application/json');
}
}
setDefaultHeaders(request.headers, parsedDefaultHeaders);
if (body && Blob.prototype.isPrototypeOf(body) && body.type) {
Expand Down Expand Up @@ -239,6 +239,16 @@ function applyInterceptors(input, interceptors, successName, errorName) {
}, Promise.resolve(input));
}

function isJSON(str) {
try {
JSON.parse(str);
} catch (err) {
return false;
}

return true;
}

function identity(x) {
return x;
}
Expand Down
22 changes: 16 additions & 6 deletions dist/system/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ System.register([], function (_export, _context) {
requestContentType = new Headers(requestInit.headers).get('Content-Type');
request = new Request(getRequestUrl(this.baseUrl, input), requestInit);
}
if (!requestContentType && new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
if (!requestContentType) {
if (new Headers(parsedDefaultHeaders).has('content-type')) {
request.headers.set('Content-Type', new Headers(parsedDefaultHeaders).get('content-type'));
} else if (body && isJSON(body)) {
request.headers.set('Content-Type', 'application/json');
}
}
setDefaultHeaders(request.headers, parsedDefaultHeaders);
if (body && Blob.prototype.isPrototypeOf(body) && body.type) {
Expand Down Expand Up @@ -114,6 +118,16 @@ System.register([], function (_export, _context) {
}, Promise.resolve(input));
}

function isJSON(str) {
try {
JSON.parse(str);
} catch (err) {
return false;
}

return true;
}

function identity(x) {
return x;
}
Expand Down Expand Up @@ -183,10 +197,6 @@ System.register([], function (_export, _context) {
if (typeof fetch === 'undefined') {
throw new Error('HttpClient requires a Fetch API implementation, but the current environment doesn\'t support it. You may need to load a polyfill such as https://github.com/github/fetch');
}

this.defaults = {
headers: { 'content-type': 'application/json' }
};
}

HttpClient.prototype.configure = function configure(config) {
Expand Down
10 changes: 10 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="1.3.1"></a>
## [1.3.1](https://github.com/aurelia/fetch-client/compare/1.3.0...v1.3.1) (2018-01-30)


### Bug Fixes

* **http-client:** Rework application/json header ([946273a](https://github.com/aurelia/fetch-client/commit/946273a)), closes [#90](https://github.com/aurelia/fetch-client/issues/90)



<a name="1.3.0"></a>
# [1.3.0](https://github.com/aurelia/fetch-client/compare/1.2.0...v1.3.0) (2018-01-24)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-fetch-client",
"version": "1.3.0",
"version": "1.3.1",
"description": "A simple client based on the Fetch standard.",
"keywords": [
"aurelia",
Expand Down

0 comments on commit 07d7196

Please sign in to comment.