Skip to content

Commit fd738ab

Browse files
committed
Merge branch 'master' of https://github.com/pagekit/vue-resource into develop
2 parents 685e102 + 0fe6533 commit fd738ab

11 files changed

+847
-471
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ $ npm install vue-resource
1818
```
1919

2020
### CDN
21-
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/vue-resource@1.3.4), [unpkg](https://unpkg.com/vue-resource@1.3.4) or [cdnjs](https://cdnjs.com/libraries/vue-resource).
21+
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/vue-resource@1.3.5), [unpkg](https://unpkg.com/vue-resource@1.3.5) or [cdnjs](https://cdnjs.com/libraries/vue-resource).
2222
```html
23-
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.3.4"></script>
23+
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.3.5"></script>
2424
```
2525

2626
## Example

bower.json

+1-1
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.3.4",
4+
"version": "1.3.5",
55
"description": "The HTTP client for Vue.js",
66
"homepage": "https://github.com/pagekit/vue-resource",
77
"license": "MIT",

build/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ rollup.rollup({
3131
format: 'es',
3232
banner: banner,
3333
footer: 'export { Url, Http, Resource };'
34-
}).then(({code}) => write('dist/vue-resource.es2015.js', code, bundle))
34+
}).then(({code}) => write('dist/vue-resource.esm.js', code, bundle))
3535
)
3636
.then(bundle =>
3737
bundle.generate({

dist/vue-resource.common.js

+36-35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-resource v1.3.4
2+
* vue-resource v1.3.5
33
* https://github.com/pagekit/vue-resource
44
* Released under the MIT License.
55
*/
@@ -272,13 +272,13 @@ var ntick;
272272

273273
var inBrowser = typeof window !== 'undefined';
274274

275-
var Util = function (ref) {
275+
function Util (ref) {
276276
var config = ref.config;
277277
var nextTick = ref.nextTick;
278278

279279
ntick = nextTick;
280280
debug = config.debug || !config.silent;
281-
};
281+
}
282282

283283
function warn(msg) {
284284
if (typeof console !== 'undefined' && debug) {
@@ -451,7 +451,7 @@ function _merge(target, source, deep) {
451451
* Root Prefix Transform.
452452
*/
453453

454-
var root = function (options$$1, next) {
454+
function root (options$$1, next) {
455455

456456
var url = next(options$$1);
457457

@@ -460,13 +460,13 @@ var root = function (options$$1, next) {
460460
}
461461

462462
return url;
463-
};
463+
}
464464

465465
/**
466466
* Query Parameter Transform.
467467
*/
468468

469-
var query = function (options$$1, next) {
469+
function query (options$$1, next) {
470470

471471
var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1);
472472

@@ -483,7 +483,7 @@ var query = function (options$$1, next) {
483483
}
484484

485485
return url;
486-
};
486+
}
487487

488488
/**
489489
* URL Template v2.0.6 (https://github.com/bramstein/url-template)
@@ -640,7 +640,7 @@ function encodeReserved(str) {
640640
* URL Template (RFC 6570) Transform.
641641
*/
642642

643-
var template = function (options) {
643+
function template (options) {
644644

645645
var variables = [], url = expand(options.url, options.params, variables);
646646

@@ -649,7 +649,7 @@ var template = function (options) {
649649
});
650650

651651
return url;
652-
};
652+
}
653653

654654
/**
655655
* Service for URL templating.
@@ -786,7 +786,7 @@ function serialize(params, obj, scope) {
786786
* XDomain client (Internet Explorer).
787787
*/
788788

789-
var xdrClient = function (request) {
789+
function xdrClient (request) {
790790
return new PromiseObj(function (resolve) {
791791

792792
var xdr = new XDomainRequest(), handler = function (ref) {
@@ -819,15 +819,15 @@ var xdrClient = function (request) {
819819
xdr.onprogress = function () {};
820820
xdr.send(request.getBody());
821821
});
822-
};
822+
}
823823

824824
/**
825825
* CORS Interceptor.
826826
*/
827827

828828
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
829829

830-
var cors = function (request, next) {
830+
function cors (request, next) {
831831

832832
if (inBrowser) {
833833

@@ -846,13 +846,13 @@ var cors = function (request, next) {
846846
}
847847

848848
next();
849-
};
849+
}
850850

851851
/**
852852
* Form data Interceptor.
853853
*/
854854

855-
var form = function (request, next) {
855+
function form (request, next) {
856856

857857
if (isFormData(request.body)) {
858858

@@ -865,13 +865,13 @@ var form = function (request, next) {
865865
}
866866

867867
next();
868-
};
868+
}
869869

870870
/**
871871
* JSON Interceptor.
872872
*/
873873

874-
var json = function (request, next) {
874+
function json (request, next) {
875875

876876
var type = request.headers.get('Content-Type') || '';
877877

@@ -902,20 +902,21 @@ var json = function (request, next) {
902902
}) : response;
903903

904904
});
905-
};
905+
}
906906

907907
function isJson(str) {
908908

909-
var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/};
909+
var start = str.match(/^\s*(\[|\{)/);
910+
var end = {'[': /]\s*$/, '{': /}\s*$/};
910911

911-
return start && end[start[0]].test(str);
912+
return start && end[start[1]].test(str);
912913
}
913914

914915
/**
915916
* JSONP client (Browser).
916917
*/
917918

918-
var jsonpClient = function (request) {
919+
function jsonpClient (request) {
919920
return new PromiseObj(function (resolve) {
920921

921922
var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
@@ -963,53 +964,53 @@ var jsonpClient = function (request) {
963964

964965
document.body.appendChild(script);
965966
});
966-
};
967+
}
967968

968969
/**
969970
* JSONP Interceptor.
970971
*/
971972

972-
var jsonp = function (request, next) {
973+
function jsonp (request, next) {
973974

974975
if (request.method == 'JSONP') {
975976
request.client = jsonpClient;
976977
}
977978

978979
next();
979-
};
980+
}
980981

981982
/**
982983
* Before Interceptor.
983984
*/
984985

985-
var before = function (request, next) {
986+
function before (request, next) {
986987

987988
if (isFunction(request.before)) {
988989
request.before.call(this, request);
989990
}
990991

991992
next();
992-
};
993+
}
993994

994995
/**
995996
* HTTP method override Interceptor.
996997
*/
997998

998-
var method = function (request, next) {
999+
function method (request, next) {
9991000

10001001
if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
10011002
request.headers.set('X-HTTP-Method-Override', request.method);
10021003
request.method = 'POST';
10031004
}
10041005

10051006
next();
1006-
};
1007+
}
10071008

10081009
/**
10091010
* Header Interceptor.
10101011
*/
10111012

1012-
var header = function (request, next) {
1013+
function header (request, next) {
10131014

10141015
var headers = assign({}, Http.headers.common,
10151016
!request.crossOrigin ? Http.headers.custom : {},
@@ -1023,13 +1024,13 @@ var header = function (request, next) {
10231024
});
10241025

10251026
next();
1026-
};
1027+
}
10271028

10281029
/**
10291030
* XMLHttp client (Browser).
10301031
*/
10311032

1032-
var xhrClient = function (request) {
1033+
function xhrClient (request) {
10331034
return new PromiseObj(function (resolve) {
10341035

10351036
var xhr = new XMLHttpRequest(), handler = function (event) {
@@ -1086,13 +1087,13 @@ var xhrClient = function (request) {
10861087
xhr.ontimeout = handler;
10871088
xhr.send(request.getBody());
10881089
});
1089-
};
1090+
}
10901091

10911092
/**
10921093
* Http client (Node).
10931094
*/
10941095

1095-
var nodeClient = function (request) {
1096+
function nodeClient (request) {
10961097

10971098
var client = require('got');
10981099

@@ -1123,13 +1124,13 @@ var nodeClient = function (request) {
11231124

11241125
}, function (error$$1) { return handler(error$$1.response); });
11251126
});
1126-
};
1127+
}
11271128

11281129
/**
11291130
* Base client.
11301131
*/
11311132

1132-
var Client = function (context) {
1133+
function Client (context) {
11331134

11341135
var reqHandlers = [sendRequest], resHandlers = [], handler;
11351136

@@ -1184,7 +1185,7 @@ var Client = function (context) {
11841185
};
11851186

11861187
return Client;
1187-
};
1188+
}
11881189

11891190
function sendRequest(request, resolve) {
11901191

0 commit comments

Comments
 (0)