Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 37df5c7

Browse files
committed
Merge branch 'release/1.1.2'
2 parents 1e9b78c + d08bc27 commit 37df5c7

File tree

10 files changed

+81
-103
lines changed

10 files changed

+81
-103
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ $ bower install vue-resource
2222
```
2323

2424
### CDN
25-
Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.1.1/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/[email protected].1/dist/vue-resource.min.js).
25+
Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.1.2/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/[email protected].2/dist/vue-resource.min.js).
2626
```html
27-
<script src="https://cdn.jsdelivr.net/vue.resource/1.1.1/vue-resource.min.js"></script>
27+
<script src="https://cdn.jsdelivr.net/vue.resource/1.1.2/vue-resource.min.js"></script>
2828
```
2929

3030
## Example

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-resource",
33
"main": "dist/vue-resource.js",
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"description": "The HTTP client for Vue.js",
66
"homepage": "https://github.com/vuejs/vue-resource",
77
"license": "MIT",

dist/vue-resource.common.js

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.1.1
2+
* vue-resource v1.1.2
33
* https://github.com/vuejs/vue-resource
44
* Released under the MIT License.
55
*/
@@ -270,6 +270,8 @@ var hasOwnProperty = ref.hasOwnProperty;
270270
var ref$1 = [];
271271
var slice = ref$1.slice;
272272

273+
var inBrowser = typeof window !== 'undefined';
274+
273275
var Util = function (Vue) {
274276
util = Vue.util;
275277
debug = Vue.config.debug || !Vue.config.silent;
@@ -309,9 +311,7 @@ function isString(val) {
309311
return typeof val === 'string';
310312
}
311313

312-
function isBoolean(val) {
313-
return val === true || val === false;
314-
}
314+
315315

316316
function isFunction(val) {
317317
return typeof val === 'function';
@@ -639,9 +639,6 @@ var template = function (options) {
639639
* Service for URL templating.
640640
*/
641641

642-
var ie = document.documentMode;
643-
var el = document.createElement('a');
644-
645642
function Url(url, params) {
646643

647644
var self = this || {}, options$$1 = url, transform;
@@ -711,7 +708,9 @@ Url.params = function (obj) {
711708

712709
Url.parse = function (url) {
713710

714-
if (ie) {
711+
var el = document.createElement('a');
712+
713+
if (document.documentMode) {
715714
el.href = url;
716715
url = el.href;
717716
}
@@ -801,34 +800,29 @@ var xdrClient = function (request) {
801800
* CORS Interceptor.
802801
*/
803802

804-
var ORIGIN_URL = Url.parse(location.href);
805-
var SUPPORTS_CORS = 'withCredentials' in new XMLHttpRequest();
803+
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
806804

807805
var cors = function (request, next) {
808806

809-
if (!isBoolean(request.crossOrigin) && crossOrigin(request)) {
810-
request.crossOrigin = true;
811-
}
807+
if (inBrowser) {
812808

813-
if (request.crossOrigin) {
809+
var orgUrl = Url.parse(location.href);
810+
var reqUrl = Url.parse(request.getUrl());
814811

815-
if (!SUPPORTS_CORS) {
816-
request.client = xdrClient;
817-
}
812+
if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
818813

819-
delete request.emulateHTTP;
814+
request.crossOrigin = true;
815+
request.emulateHTTP = false;
816+
817+
if (!SUPPORTS_CORS) {
818+
request.client = xdrClient;
819+
}
820+
}
820821
}
821822

822823
next();
823824
};
824825

825-
function crossOrigin(request) {
826-
827-
var requestUrl = Url.parse(Url(request));
828-
829-
return (requestUrl.protocol !== ORIGIN_URL.protocol || requestUrl.host !== ORIGIN_URL.host);
830-
}
831-
832826
/**
833827
* Body Interceptor.
834828
*/

dist/vue-resource.es2015.js

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.1.1
2+
* vue-resource v1.1.2
33
* https://github.com/vuejs/vue-resource
44
* Released under the MIT License.
55
*/
@@ -268,6 +268,8 @@ var hasOwnProperty = ref.hasOwnProperty;
268268
var ref$1 = [];
269269
var slice = ref$1.slice;
270270

271+
var inBrowser = typeof window !== 'undefined';
272+
271273
var Util = function (Vue) {
272274
util = Vue.util;
273275
debug = Vue.config.debug || !Vue.config.silent;
@@ -307,9 +309,7 @@ function isString(val) {
307309
return typeof val === 'string';
308310
}
309311

310-
function isBoolean(val) {
311-
return val === true || val === false;
312-
}
312+
313313

314314
function isFunction(val) {
315315
return typeof val === 'function';
@@ -637,9 +637,6 @@ var template = function (options) {
637637
* Service for URL templating.
638638
*/
639639

640-
var ie = document.documentMode;
641-
var el = document.createElement('a');
642-
643640
function Url(url, params) {
644641

645642
var self = this || {}, options$$1 = url, transform;
@@ -709,7 +706,9 @@ Url.params = function (obj) {
709706

710707
Url.parse = function (url) {
711708

712-
if (ie) {
709+
var el = document.createElement('a');
710+
711+
if (document.documentMode) {
713712
el.href = url;
714713
url = el.href;
715714
}
@@ -799,34 +798,29 @@ var xdrClient = function (request) {
799798
* CORS Interceptor.
800799
*/
801800

802-
var ORIGIN_URL = Url.parse(location.href);
803-
var SUPPORTS_CORS = 'withCredentials' in new XMLHttpRequest();
801+
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
804802

805803
var cors = function (request, next) {
806804

807-
if (!isBoolean(request.crossOrigin) && crossOrigin(request)) {
808-
request.crossOrigin = true;
809-
}
805+
if (inBrowser) {
810806

811-
if (request.crossOrigin) {
807+
var orgUrl = Url.parse(location.href);
808+
var reqUrl = Url.parse(request.getUrl());
812809

813-
if (!SUPPORTS_CORS) {
814-
request.client = xdrClient;
815-
}
810+
if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
816811

817-
delete request.emulateHTTP;
812+
request.crossOrigin = true;
813+
request.emulateHTTP = false;
814+
815+
if (!SUPPORTS_CORS) {
816+
request.client = xdrClient;
817+
}
818+
}
818819
}
819820

820821
next();
821822
};
822823

823-
function crossOrigin(request) {
824-
825-
var requestUrl = Url.parse(Url(request));
826-
827-
return (requestUrl.protocol !== ORIGIN_URL.protocol || requestUrl.host !== ORIGIN_URL.host);
828-
}
829-
830824
/**
831825
* Body Interceptor.
832826
*/

dist/vue-resource.js

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.1.1
2+
* vue-resource v1.1.2
33
* https://github.com/vuejs/vue-resource
44
* Released under the MIT License.
55
*/
@@ -274,6 +274,8 @@ var hasOwnProperty = ref.hasOwnProperty;
274274
var ref$1 = [];
275275
var slice = ref$1.slice;
276276

277+
var inBrowser = typeof window !== 'undefined';
278+
277279
var Util = function (Vue) {
278280
util = Vue.util;
279281
debug = Vue.config.debug || !Vue.config.silent;
@@ -313,9 +315,7 @@ function isString(val) {
313315
return typeof val === 'string';
314316
}
315317

316-
function isBoolean(val) {
317-
return val === true || val === false;
318-
}
318+
319319

320320
function isFunction(val) {
321321
return typeof val === 'function';
@@ -643,9 +643,6 @@ var template = function (options) {
643643
* Service for URL templating.
644644
*/
645645

646-
var ie = document.documentMode;
647-
var el = document.createElement('a');
648-
649646
function Url(url, params) {
650647

651648
var self = this || {}, options$$1 = url, transform;
@@ -715,7 +712,9 @@ Url.params = function (obj) {
715712

716713
Url.parse = function (url) {
717714

718-
if (ie) {
715+
var el = document.createElement('a');
716+
717+
if (document.documentMode) {
719718
el.href = url;
720719
url = el.href;
721720
}
@@ -805,34 +804,29 @@ var xdrClient = function (request) {
805804
* CORS Interceptor.
806805
*/
807806

808-
var ORIGIN_URL = Url.parse(location.href);
809-
var SUPPORTS_CORS = 'withCredentials' in new XMLHttpRequest();
807+
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
810808

811809
var cors = function (request, next) {
812810

813-
if (!isBoolean(request.crossOrigin) && crossOrigin(request)) {
814-
request.crossOrigin = true;
815-
}
811+
if (inBrowser) {
816812

817-
if (request.crossOrigin) {
813+
var orgUrl = Url.parse(location.href);
814+
var reqUrl = Url.parse(request.getUrl());
818815

819-
if (!SUPPORTS_CORS) {
820-
request.client = xdrClient;
821-
}
816+
if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
822817

823-
delete request.emulateHTTP;
818+
request.crossOrigin = true;
819+
request.emulateHTTP = false;
820+
821+
if (!SUPPORTS_CORS) {
822+
request.client = xdrClient;
823+
}
824+
}
824825
}
825826

826827
next();
827828
};
828829

829-
function crossOrigin(request) {
830-
831-
var requestUrl = Url.parse(Url(request));
832-
833-
return (requestUrl.protocol !== ORIGIN_URL.protocol || requestUrl.host !== ORIGIN_URL.host);
834-
}
835-
836830
/**
837831
* Body Interceptor.
838832
*/

0 commit comments

Comments
 (0)