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

Commit 65054a6

Browse files
author
Steffan
committed
Merge branch 'release/1.3.0'
2 parents a9483d0 + f427c42 commit 65054a6

File tree

15 files changed

+219
-101
lines changed

15 files changed

+219
-101
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
Got a question?
3+
===============
4+
The issue list of this repo is exclusively for bug reports and feature requests. For questions, please use the following resources:
5+
6+
- Read the docs: https://github.com/pagekit/vue-resource/tree/master/docs
7+
- Look for/ask questions on stack overflow: http://stackoverflow.com/search?q=vue-resource
8+
9+
Thank you!
10+
-->
11+
12+
<!-- BUG REPORT TEMPLATE -->
13+
### Reproduction Link
14+
<!-- A minimal jsfiddle that can reproduce the bug. -->
15+
<!-- You could start with this template: https://jsfiddle.net/qhh7sqc6/ -->
16+
17+
### Steps to reproduce
18+
<!-- Incl. which version is used on what browser and device. -->
19+
20+
### What is Expected?
21+
22+
### What is actually happening?

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2016 steffans
3+
Copyright (c) 2015-2017 steffans
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

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.2.1/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/vue-resource@1.2.1/dist/vue-resource.min.js).
25+
Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.3.0/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/vue-resource@1.3.0/dist/vue-resource.min.js).
2626
```html
27-
<script src="https://cdn.jsdelivr.net/vue.resource/1.2.1/vue-resource.min.js"></script>
27+
<script src="https://cdn.jsdelivr.net/vue.resource/1.3.0/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.2.1",
4+
"version": "1.3.0",
55
"description": "The HTTP client for Vue.js",
66
"homepage": "https://github.com/pagekit/vue-resource",
77
"license": "MIT",

dist/vue-resource.common.js

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.2.1
2+
* vue-resource v1.3.0
33
* https://github.com/pagekit/vue-resource
44
* Released under the MIT License.
55
*/
@@ -653,7 +653,15 @@ function Url(url, params) {
653653
options$$1 = merge({}, Url.options, self.$options, options$$1);
654654

655655
Url.transforms.forEach(function (handler) {
656-
transform = factory(handler, transform, self.$vm);
656+
657+
if (isString(handler)) {
658+
handler = Url.transform[handler];
659+
}
660+
661+
if (isFunction(handler)) {
662+
transform = factory(handler, transform, self.$vm);
663+
}
664+
657665
});
658666

659667
return transform(options$$1);
@@ -673,7 +681,8 @@ Url.options = {
673681
* Url transforms.
674682
*/
675683

676-
Url.transforms = [template, query, root];
684+
Url.transform = {template: template, query: query, root: root};
685+
Url.transforms = ['template', 'query', 'root'];
677686

678687
/**
679688
* Encodes a Url parameter string.
@@ -1008,8 +1017,6 @@ var header = function (request, next) {
10081017
* XMLHttp client (Browser).
10091018
*/
10101019

1011-
var SUPPORTS_BLOB = typeof Blob !== 'undefined' && typeof FileReader !== 'undefined';
1012-
10131020
var xhrClient = function (request) {
10141021
return new PromiseObj(function (resolve) {
10151022

@@ -1045,18 +1052,18 @@ var xhrClient = function (request) {
10451052
xhr.timeout = request.timeout;
10461053
}
10471054

1048-
if (request.credentials === true) {
1055+
if (request.responseType && 'responseType' in xhr) {
1056+
xhr.responseType = request.responseType;
1057+
}
1058+
1059+
if (request.withCredentials || request.credentials) {
10491060
xhr.withCredentials = true;
10501061
}
10511062

10521063
if (!request.crossOrigin) {
10531064
request.headers.set('X-Requested-With', 'XMLHttpRequest');
10541065
}
10551066

1056-
if ('responseType' in xhr && SUPPORTS_BLOB) {
1057-
xhr.responseType = 'blob';
1058-
}
1059-
10601067
request.headers.forEach(function (value, name) {
10611068
xhr.setRequestHeader(name, value);
10621069
});
@@ -1353,7 +1360,15 @@ function Http(options$$1) {
13531360
defaults(options$$1 || {}, self.$options, Http.options);
13541361

13551362
Http.interceptors.forEach(function (handler) {
1356-
client.use(handler);
1363+
1364+
if (isString(handler)) {
1365+
handler = Http.interceptor[handler];
1366+
}
1367+
1368+
if (isFunction(handler)) {
1369+
client.use(handler);
1370+
}
1371+
13571372
});
13581373

13591374
return client(new Request(options$$1)).then(function (response) {
@@ -1381,7 +1396,8 @@ Http.headers = {
13811396
custom: {}
13821397
};
13831398

1384-
Http.interceptors = [before, method, body, jsonp, header, cors];
1399+
Http.interceptor = {before: before, method: method, body: body, jsonp: jsonp, header: header, cors: cors};
1400+
Http.interceptors = ['before', 'method', 'body', 'jsonp', 'header', 'cors'];
13851401

13861402
['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
13871403

dist/vue-resource.es2015.js

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.2.1
2+
* vue-resource v1.3.0
33
* https://github.com/pagekit/vue-resource
44
* Released under the MIT License.
55
*/
@@ -651,7 +651,15 @@ function Url(url, params) {
651651
options$$1 = merge({}, Url.options, self.$options, options$$1);
652652

653653
Url.transforms.forEach(function (handler) {
654-
transform = factory(handler, transform, self.$vm);
654+
655+
if (isString(handler)) {
656+
handler = Url.transform[handler];
657+
}
658+
659+
if (isFunction(handler)) {
660+
transform = factory(handler, transform, self.$vm);
661+
}
662+
655663
});
656664

657665
return transform(options$$1);
@@ -671,7 +679,8 @@ Url.options = {
671679
* Url transforms.
672680
*/
673681

674-
Url.transforms = [template, query, root];
682+
Url.transform = {template: template, query: query, root: root};
683+
Url.transforms = ['template', 'query', 'root'];
675684

676685
/**
677686
* Encodes a Url parameter string.
@@ -1006,8 +1015,6 @@ var header = function (request, next) {
10061015
* XMLHttp client (Browser).
10071016
*/
10081017

1009-
var SUPPORTS_BLOB = typeof Blob !== 'undefined' && typeof FileReader !== 'undefined';
1010-
10111018
var xhrClient = function (request) {
10121019
return new PromiseObj(function (resolve) {
10131020

@@ -1043,18 +1050,18 @@ var xhrClient = function (request) {
10431050
xhr.timeout = request.timeout;
10441051
}
10451052

1046-
if (request.credentials === true) {
1053+
if (request.responseType && 'responseType' in xhr) {
1054+
xhr.responseType = request.responseType;
1055+
}
1056+
1057+
if (request.withCredentials || request.credentials) {
10471058
xhr.withCredentials = true;
10481059
}
10491060

10501061
if (!request.crossOrigin) {
10511062
request.headers.set('X-Requested-With', 'XMLHttpRequest');
10521063
}
10531064

1054-
if ('responseType' in xhr && SUPPORTS_BLOB) {
1055-
xhr.responseType = 'blob';
1056-
}
1057-
10581065
request.headers.forEach(function (value, name) {
10591066
xhr.setRequestHeader(name, value);
10601067
});
@@ -1351,7 +1358,15 @@ function Http(options$$1) {
13511358
defaults(options$$1 || {}, self.$options, Http.options);
13521359

13531360
Http.interceptors.forEach(function (handler) {
1354-
client.use(handler);
1361+
1362+
if (isString(handler)) {
1363+
handler = Http.interceptor[handler];
1364+
}
1365+
1366+
if (isFunction(handler)) {
1367+
client.use(handler);
1368+
}
1369+
13551370
});
13561371

13571372
return client(new Request(options$$1)).then(function (response) {
@@ -1379,7 +1394,8 @@ Http.headers = {
13791394
custom: {}
13801395
};
13811396

1382-
Http.interceptors = [before, method, body, jsonp, header, cors];
1397+
Http.interceptor = {before: before, method: method, body: body, jsonp: jsonp, header: header, cors: cors};
1398+
Http.interceptors = ['before', 'method', 'body', 'jsonp', 'header', 'cors'];
13831399

13841400
['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
13851401

dist/vue-resource.js

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.2.1
2+
* vue-resource v1.3.0
33
* https://github.com/pagekit/vue-resource
44
* Released under the MIT License.
55
*/
@@ -657,7 +657,15 @@ function Url(url, params) {
657657
options$$1 = merge({}, Url.options, self.$options, options$$1);
658658

659659
Url.transforms.forEach(function (handler) {
660-
transform = factory(handler, transform, self.$vm);
660+
661+
if (isString(handler)) {
662+
handler = Url.transform[handler];
663+
}
664+
665+
if (isFunction(handler)) {
666+
transform = factory(handler, transform, self.$vm);
667+
}
668+
661669
});
662670

663671
return transform(options$$1);
@@ -677,7 +685,8 @@ Url.options = {
677685
* Url transforms.
678686
*/
679687

680-
Url.transforms = [template, query, root];
688+
Url.transform = {template: template, query: query, root: root};
689+
Url.transforms = ['template', 'query', 'root'];
681690

682691
/**
683692
* Encodes a Url parameter string.
@@ -1012,8 +1021,6 @@ var header = function (request, next) {
10121021
* XMLHttp client (Browser).
10131022
*/
10141023

1015-
var SUPPORTS_BLOB = typeof Blob !== 'undefined' && typeof FileReader !== 'undefined';
1016-
10171024
var xhrClient = function (request) {
10181025
return new PromiseObj(function (resolve) {
10191026

@@ -1049,18 +1056,18 @@ var xhrClient = function (request) {
10491056
xhr.timeout = request.timeout;
10501057
}
10511058

1052-
if (request.credentials === true) {
1059+
if (request.responseType && 'responseType' in xhr) {
1060+
xhr.responseType = request.responseType;
1061+
}
1062+
1063+
if (request.withCredentials || request.credentials) {
10531064
xhr.withCredentials = true;
10541065
}
10551066

10561067
if (!request.crossOrigin) {
10571068
request.headers.set('X-Requested-With', 'XMLHttpRequest');
10581069
}
10591070

1060-
if ('responseType' in xhr && SUPPORTS_BLOB) {
1061-
xhr.responseType = 'blob';
1062-
}
1063-
10641071
request.headers.forEach(function (value, name) {
10651072
xhr.setRequestHeader(name, value);
10661073
});
@@ -1357,7 +1364,15 @@ function Http(options$$1) {
13571364
defaults(options$$1 || {}, self.$options, Http.options);
13581365

13591366
Http.interceptors.forEach(function (handler) {
1360-
client.use(handler);
1367+
1368+
if (isString(handler)) {
1369+
handler = Http.interceptor[handler];
1370+
}
1371+
1372+
if (isFunction(handler)) {
1373+
client.use(handler);
1374+
}
1375+
13611376
});
13621377

13631378
return client(new Request(options$$1)).then(function (response) {
@@ -1385,7 +1400,8 @@ Http.headers = {
13851400
custom: {}
13861401
};
13871402

1388-
Http.interceptors = [before, method, body, jsonp, header, cors];
1403+
Http.interceptor = {before: before, method: method, body: body, jsonp: jsonp, header: header, cors: cors};
1404+
Http.interceptors = ['before', 'method', 'body', 'jsonp', 'header', 'cors'];
13891405

13901406
['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
13911407

0 commit comments

Comments
 (0)