From bab013c58baefabcc280af1793a7b1cc50451628 Mon Sep 17 00:00:00 2001 From: Steffan Date: Wed, 20 Dec 2017 10:29:46 +0100 Subject: [PATCH] v1.3.5 --- README.md | 4 +- bower.json | 2 +- build/build.js | 2 +- dist/vue-resource.common.js | 71 ++++++++++--------- ...resource.es2015.js => vue-resource.esm.js} | 71 ++++++++++--------- dist/vue-resource.js | 71 ++++++++++--------- dist/vue-resource.min.js | 4 +- package.json | 4 +- 8 files changed, 116 insertions(+), 113 deletions(-) rename dist/{vue-resource.es2015.js => vue-resource.esm.js} (97%) diff --git a/README.md b/README.md index b55943c2..92143888 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ $ npm install vue-resource ``` ### CDN -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). +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). ```html - + ``` ## Example diff --git a/bower.json b/bower.json index 1fe6ddeb..70cb1638 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "vue-resource", "main": "dist/vue-resource.js", - "version": "1.3.4", + "version": "1.3.5", "description": "The HTTP client for Vue.js", "homepage": "https://github.com/pagekit/vue-resource", "license": "MIT", diff --git a/build/build.js b/build/build.js index 2ee25fc6..b5f412ba 100644 --- a/build/build.js +++ b/build/build.js @@ -31,7 +31,7 @@ rollup.rollup({ format: 'es', banner: banner, footer: 'export { Url, Http, Resource };' - }).then(({code}) => write('dist/vue-resource.es2015.js', code, bundle)) + }).then(({code}) => write('dist/vue-resource.esm.js', code, bundle)) ) .then(bundle => bundle.generate({ diff --git a/dist/vue-resource.common.js b/dist/vue-resource.common.js index 4ef216cd..f76f42ff 100644 --- a/dist/vue-resource.common.js +++ b/dist/vue-resource.common.js @@ -1,5 +1,5 @@ /*! - * vue-resource v1.3.4 + * vue-resource v1.3.5 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ @@ -272,13 +272,13 @@ var ntick; var inBrowser = typeof window !== 'undefined'; -var Util = function (ref) { +function Util (ref) { var config = ref.config; var nextTick = ref.nextTick; ntick = nextTick; debug = config.debug || !config.silent; -}; +} function warn(msg) { if (typeof console !== 'undefined' && debug) { @@ -451,7 +451,7 @@ function _merge(target, source, deep) { * Root Prefix Transform. */ -var root = function (options$$1, next) { +function root (options$$1, next) { var url = next(options$$1); @@ -460,13 +460,13 @@ var root = function (options$$1, next) { } return url; -}; +} /** * Query Parameter Transform. */ -var query = function (options$$1, next) { +function query (options$$1, next) { var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1); @@ -483,7 +483,7 @@ var query = function (options$$1, next) { } return url; -}; +} /** * URL Template v2.0.6 (https://github.com/bramstein/url-template) @@ -640,7 +640,7 @@ function encodeReserved(str) { * URL Template (RFC 6570) Transform. */ -var template = function (options) { +function template (options) { var variables = [], url = expand(options.url, options.params, variables); @@ -649,7 +649,7 @@ var template = function (options) { }); return url; -}; +} /** * Service for URL templating. @@ -786,7 +786,7 @@ function serialize(params, obj, scope) { * XDomain client (Internet Explorer). */ -var xdrClient = function (request) { +function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), handler = function (ref) { @@ -819,7 +819,7 @@ var xdrClient = function (request) { xdr.onprogress = function () {}; xdr.send(request.getBody()); }); -}; +} /** * CORS Interceptor. @@ -827,7 +827,7 @@ var xdrClient = function (request) { var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest(); -var cors = function (request, next) { +function cors (request, next) { if (inBrowser) { @@ -846,13 +846,13 @@ var cors = function (request, next) { } next(); -}; +} /** * Form data Interceptor. */ -var form = function (request, next) { +function form (request, next) { if (isFormData(request.body)) { @@ -865,13 +865,13 @@ var form = function (request, next) { } next(); -}; +} /** * JSON Interceptor. */ -var json = function (request, next) { +function json (request, next) { var type = request.headers.get('Content-Type') || ''; @@ -902,20 +902,21 @@ var json = function (request, next) { }) : response; }); -}; +} function isJson(str) { - var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/}; + var start = str.match(/^\s*(\[|\{)/); + var end = {'[': /]\s*$/, '{': /}\s*$/}; - return start && end[start[0]].test(str); + return start && end[start[1]].test(str); } /** * JSONP client (Browser). */ -var jsonpClient = function (request) { +function jsonpClient (request) { return new PromiseObj(function (resolve) { var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script; @@ -963,39 +964,39 @@ var jsonpClient = function (request) { document.body.appendChild(script); }); -}; +} /** * JSONP Interceptor. */ -var jsonp = function (request, next) { +function jsonp (request, next) { if (request.method == 'JSONP') { request.client = jsonpClient; } next(); -}; +} /** * Before Interceptor. */ -var before = function (request, next) { +function before (request, next) { if (isFunction(request.before)) { request.before.call(this, request); } next(); -}; +} /** * HTTP method override Interceptor. */ -var method = function (request, next) { +function method (request, next) { if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) { request.headers.set('X-HTTP-Method-Override', request.method); @@ -1003,13 +1004,13 @@ var method = function (request, next) { } next(); -}; +} /** * Header Interceptor. */ -var header = function (request, next) { +function header (request, next) { var headers = assign({}, Http.headers.common, !request.crossOrigin ? Http.headers.custom : {}, @@ -1023,13 +1024,13 @@ var header = function (request, next) { }); next(); -}; +} /** * XMLHttp client (Browser). */ -var xhrClient = function (request) { +function xhrClient (request) { return new PromiseObj(function (resolve) { var xhr = new XMLHttpRequest(), handler = function (event) { @@ -1086,13 +1087,13 @@ var xhrClient = function (request) { xhr.ontimeout = handler; xhr.send(request.getBody()); }); -}; +} /** * Http client (Node). */ -var nodeClient = function (request) { +function nodeClient (request) { var client = require('got'); @@ -1123,13 +1124,13 @@ var nodeClient = function (request) { }, function (error$$1) { return handler(error$$1.response); }); }); -}; +} /** * Base client. */ -var Client = function (context) { +function Client (context) { var reqHandlers = [sendRequest], resHandlers = [], handler; @@ -1184,7 +1185,7 @@ var Client = function (context) { }; return Client; -}; +} function sendRequest(request, resolve) { diff --git a/dist/vue-resource.es2015.js b/dist/vue-resource.esm.js similarity index 97% rename from dist/vue-resource.es2015.js rename to dist/vue-resource.esm.js index 963ad5e9..a12ef09d 100644 --- a/dist/vue-resource.es2015.js +++ b/dist/vue-resource.esm.js @@ -1,5 +1,5 @@ /*! - * vue-resource v1.3.4 + * vue-resource v1.3.5 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ @@ -270,13 +270,13 @@ var ntick; var inBrowser = typeof window !== 'undefined'; -var Util = function (ref) { +function Util (ref) { var config = ref.config; var nextTick = ref.nextTick; ntick = nextTick; debug = config.debug || !config.silent; -}; +} function warn(msg) { if (typeof console !== 'undefined' && debug) { @@ -449,7 +449,7 @@ function _merge(target, source, deep) { * Root Prefix Transform. */ -var root = function (options$$1, next) { +function root (options$$1, next) { var url = next(options$$1); @@ -458,13 +458,13 @@ var root = function (options$$1, next) { } return url; -}; +} /** * Query Parameter Transform. */ -var query = function (options$$1, next) { +function query (options$$1, next) { var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1); @@ -481,7 +481,7 @@ var query = function (options$$1, next) { } return url; -}; +} /** * URL Template v2.0.6 (https://github.com/bramstein/url-template) @@ -638,7 +638,7 @@ function encodeReserved(str) { * URL Template (RFC 6570) Transform. */ -var template = function (options) { +function template (options) { var variables = [], url = expand(options.url, options.params, variables); @@ -647,7 +647,7 @@ var template = function (options) { }); return url; -}; +} /** * Service for URL templating. @@ -784,7 +784,7 @@ function serialize(params, obj, scope) { * XDomain client (Internet Explorer). */ -var xdrClient = function (request) { +function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), handler = function (ref) { @@ -817,7 +817,7 @@ var xdrClient = function (request) { xdr.onprogress = function () {}; xdr.send(request.getBody()); }); -}; +} /** * CORS Interceptor. @@ -825,7 +825,7 @@ var xdrClient = function (request) { var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest(); -var cors = function (request, next) { +function cors (request, next) { if (inBrowser) { @@ -844,13 +844,13 @@ var cors = function (request, next) { } next(); -}; +} /** * Form data Interceptor. */ -var form = function (request, next) { +function form (request, next) { if (isFormData(request.body)) { @@ -863,13 +863,13 @@ var form = function (request, next) { } next(); -}; +} /** * JSON Interceptor. */ -var json = function (request, next) { +function json (request, next) { var type = request.headers.get('Content-Type') || ''; @@ -900,20 +900,21 @@ var json = function (request, next) { }) : response; }); -}; +} function isJson(str) { - var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/}; + var start = str.match(/^\s*(\[|\{)/); + var end = {'[': /]\s*$/, '{': /}\s*$/}; - return start && end[start[0]].test(str); + return start && end[start[1]].test(str); } /** * JSONP client (Browser). */ -var jsonpClient = function (request) { +function jsonpClient (request) { return new PromiseObj(function (resolve) { var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script; @@ -961,39 +962,39 @@ var jsonpClient = function (request) { document.body.appendChild(script); }); -}; +} /** * JSONP Interceptor. */ -var jsonp = function (request, next) { +function jsonp (request, next) { if (request.method == 'JSONP') { request.client = jsonpClient; } next(); -}; +} /** * Before Interceptor. */ -var before = function (request, next) { +function before (request, next) { if (isFunction(request.before)) { request.before.call(this, request); } next(); -}; +} /** * HTTP method override Interceptor. */ -var method = function (request, next) { +function method (request, next) { if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) { request.headers.set('X-HTTP-Method-Override', request.method); @@ -1001,13 +1002,13 @@ var method = function (request, next) { } next(); -}; +} /** * Header Interceptor. */ -var header = function (request, next) { +function header (request, next) { var headers = assign({}, Http.headers.common, !request.crossOrigin ? Http.headers.custom : {}, @@ -1021,13 +1022,13 @@ var header = function (request, next) { }); next(); -}; +} /** * XMLHttp client (Browser). */ -var xhrClient = function (request) { +function xhrClient (request) { return new PromiseObj(function (resolve) { var xhr = new XMLHttpRequest(), handler = function (event) { @@ -1084,13 +1085,13 @@ var xhrClient = function (request) { xhr.ontimeout = handler; xhr.send(request.getBody()); }); -}; +} /** * Http client (Node). */ -var nodeClient = function (request) { +function nodeClient (request) { var client = require('got'); @@ -1121,13 +1122,13 @@ var nodeClient = function (request) { }, function (error$$1) { return handler(error$$1.response); }); }); -}; +} /** * Base client. */ -var Client = function (context) { +function Client (context) { var reqHandlers = [sendRequest], resHandlers = [], handler; @@ -1182,7 +1183,7 @@ var Client = function (context) { }; return Client; -}; +} function sendRequest(request, resolve) { diff --git a/dist/vue-resource.js b/dist/vue-resource.js index c3ebb9ac..b0d6811c 100644 --- a/dist/vue-resource.js +++ b/dist/vue-resource.js @@ -1,5 +1,5 @@ /*! - * vue-resource v1.3.4 + * vue-resource v1.3.5 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ @@ -276,13 +276,13 @@ var ntick; var inBrowser = typeof window !== 'undefined'; -var Util = function (ref) { +function Util (ref) { var config = ref.config; var nextTick = ref.nextTick; ntick = nextTick; debug = config.debug || !config.silent; -}; +} function warn(msg) { if (typeof console !== 'undefined' && debug) { @@ -455,7 +455,7 @@ function _merge(target, source, deep) { * Root Prefix Transform. */ -var root = function (options$$1, next) { +function root (options$$1, next) { var url = next(options$$1); @@ -464,13 +464,13 @@ var root = function (options$$1, next) { } return url; -}; +} /** * Query Parameter Transform. */ -var query = function (options$$1, next) { +function query (options$$1, next) { var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1); @@ -487,7 +487,7 @@ var query = function (options$$1, next) { } return url; -}; +} /** * URL Template v2.0.6 (https://github.com/bramstein/url-template) @@ -644,7 +644,7 @@ function encodeReserved(str) { * URL Template (RFC 6570) Transform. */ -var template = function (options) { +function template (options) { var variables = [], url = expand(options.url, options.params, variables); @@ -653,7 +653,7 @@ var template = function (options) { }); return url; -}; +} /** * Service for URL templating. @@ -790,7 +790,7 @@ function serialize(params, obj, scope) { * XDomain client (Internet Explorer). */ -var xdrClient = function (request) { +function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), handler = function (ref) { @@ -823,7 +823,7 @@ var xdrClient = function (request) { xdr.onprogress = function () {}; xdr.send(request.getBody()); }); -}; +} /** * CORS Interceptor. @@ -831,7 +831,7 @@ var xdrClient = function (request) { var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest(); -var cors = function (request, next) { +function cors (request, next) { if (inBrowser) { @@ -850,13 +850,13 @@ var cors = function (request, next) { } next(); -}; +} /** * Form data Interceptor. */ -var form = function (request, next) { +function form (request, next) { if (isFormData(request.body)) { @@ -869,13 +869,13 @@ var form = function (request, next) { } next(); -}; +} /** * JSON Interceptor. */ -var json = function (request, next) { +function json (request, next) { var type = request.headers.get('Content-Type') || ''; @@ -906,20 +906,21 @@ var json = function (request, next) { }) : response; }); -}; +} function isJson(str) { - var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/}; + var start = str.match(/^\s*(\[|\{)/); + var end = {'[': /]\s*$/, '{': /}\s*$/}; - return start && end[start[0]].test(str); + return start && end[start[1]].test(str); } /** * JSONP client (Browser). */ -var jsonpClient = function (request) { +function jsonpClient (request) { return new PromiseObj(function (resolve) { var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script; @@ -967,39 +968,39 @@ var jsonpClient = function (request) { document.body.appendChild(script); }); -}; +} /** * JSONP Interceptor. */ -var jsonp = function (request, next) { +function jsonp (request, next) { if (request.method == 'JSONP') { request.client = jsonpClient; } next(); -}; +} /** * Before Interceptor. */ -var before = function (request, next) { +function before (request, next) { if (isFunction(request.before)) { request.before.call(this, request); } next(); -}; +} /** * HTTP method override Interceptor. */ -var method = function (request, next) { +function method (request, next) { if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) { request.headers.set('X-HTTP-Method-Override', request.method); @@ -1007,13 +1008,13 @@ var method = function (request, next) { } next(); -}; +} /** * Header Interceptor. */ -var header = function (request, next) { +function header (request, next) { var headers = assign({}, Http.headers.common, !request.crossOrigin ? Http.headers.custom : {}, @@ -1027,13 +1028,13 @@ var header = function (request, next) { }); next(); -}; +} /** * XMLHttp client (Browser). */ -var xhrClient = function (request) { +function xhrClient (request) { return new PromiseObj(function (resolve) { var xhr = new XMLHttpRequest(), handler = function (event) { @@ -1090,13 +1091,13 @@ var xhrClient = function (request) { xhr.ontimeout = handler; xhr.send(request.getBody()); }); -}; +} /** * Http client (Node). */ -var nodeClient = function (request) { +function nodeClient (request) { var client = require('got'); @@ -1127,13 +1128,13 @@ var nodeClient = function (request) { }, function (error$$1) { return handler(error$$1.response); }); }); -}; +} /** * Base client. */ -var Client = function (context) { +function Client (context) { var reqHandlers = [sendRequest], resHandlers = [], handler; @@ -1188,7 +1189,7 @@ var Client = function (context) { }; return Client; -}; +} function sendRequest(request, resolve) { diff --git a/dist/vue-resource.min.js b/dist/vue-resource.min.js index 5d2e09bb..aab3bda4 100644 --- a/dist/vue-resource.min.js +++ b/dist/vue-resource.min.js @@ -1,7 +1,7 @@ /*! - * vue-resource v1.3.4 + * vue-resource v1.3.5 * https://github.com/pagekit/vue-resource * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=J,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){"undefined"!=typeof console&&_&&console.warn("[VueResource warn]: "+t)}function o(t){"undefined"!=typeof console&&console.error(t)}function r(t,e){return F(t,e)}function i(t){return t?t.replace(/^\s*|\s*$/g,""):""}function u(t,e){return t&&void 0===e?t.replace(/\s+$/,""):t&&e?t.replace(new RegExp("["+e+"]+$"),""):t}function s(t){return t?t.toLowerCase():""}function a(t){return t?t.toUpperCase():""}function c(t){return"string"==typeof t}function f(t){return"function"==typeof t}function p(t){return null!==t&&"object"==typeof t}function h(t){return p(t)&&Object.getPrototypeOf(t)==Object.prototype}function d(t){return"undefined"!=typeof Blob&&t instanceof Blob}function l(t){return"undefined"!=typeof FormData&&t instanceof FormData}function m(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function y(t,e,n){return n=n||{},f(n)&&(n=n.call(e)),b(t.bind({$vm:e,$options:n}),t,{$options:n})}function v(t,e){var n,o;if(Q(t))for(n=0;n=200&&r<300,this.status=r||0,this.statusText=i||"",this.headers=new mt(o),this.body=t,c(t)?this.bodyText=t:d(t)&&(this.bodyBlob=t,L(t)&&(this.bodyText=H(t)))};yt.prototype.blob=function(){return m(this.bodyBlob)},yt.prototype.text=function(){return m(this.bodyText)},yt.prototype.json=function(){return m(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(yt.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var vt=function(t){this.body=null,this.params={},Y(this,t,{method:a(t.method||"GET")}),this.headers instanceof mt||(this.headers=new mt(this.headers))};vt.prototype.getUrl=function(){return U(this)},vt.prototype.getBody=function(){return this.body},vt.prototype.respondWith=function(t,e){return new yt(t,Y(e||{},{url:this.getUrl()}))};var bt={Accept:"application/json, text/plain, */*"},gt={"Content-Type":"application/json;charset=utf-8"};return B.options={},B.headers={put:gt,post:gt,patch:gt,delete:gt,common:bt,custom:{}},B.interceptor={before:ct,method:ft,jsonp:at,json:ut,form:it,header:pt,cors:rt},B.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(t){B[t]=function(e,n){return this(Y(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){B[t]=function(e,n,o){return this(Y(o||{},{url:e,method:t,body:n}))}}),M.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(D),D}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=$,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){return t?t.replace(/^\s*|\s*$/g,""):""}function o(t){return t?t.toLowerCase():""}function r(t){return"string"==typeof t}function i(t){return"function"==typeof t}function s(t){return null!==t&&"object"==typeof t}function u(t){return s(t)&&Object.getPrototypeOf(t)==Object.prototype}function a(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function c(t,e,n){return n=n||{},i(n)&&(n=n.call(e)),p(t.bind({$vm:e,$options:n}),t,{$options:n})}function f(t,e){var n,o;if(H(t))for(n=0;n=200&&s<300,this.status=s||0,this.statusText=u||"",this.headers=new M(i),this.body=t,r(t)?this.bodyText=t:function(t){return"undefined"!=typeof Blob&&t instanceof Blob}(t)&&(this.bodyBlob=t,function(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}(t)&&(this.bodyText=function(t){return new e(function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}})}(t)))};N.prototype.blob=function(){return a(this.bodyBlob)},N.prototype.text=function(){return a(this.bodyText)},N.prototype.json=function(){return a(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(N.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var D=function(t){this.body=null,this.params={},L(this,t,{method:function(t){return t?t.toUpperCase():""}(t.method||"GET")}),this.headers instanceof M||(this.headers=new M(this.headers))};D.prototype.getUrl=function(){return b(this)},D.prototype.getBody=function(){return this.body},D.prototype.respondWith=function(t,e){return new N(t,L(e||{},{url:this.getUrl()}))};var J={"Content-Type":"application/json;charset=utf-8"};return O.options={},O.headers={put:J,post:J,patch:J,delete:J,common:{Accept:"application/json, text/plain, */*"},custom:{}},O.interceptor={before:function(t,e){i(t.before)&&t.before.call(this,t),e()},method:function(t,e){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST"),e()},jsonp:function(t,e){"JSONP"==t.method&&(t.client=T),e()},json:function(t,e){var n=t.headers.get("Content-Type")||"";s(t.body)&&0===n.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),e(function(t){return t.bodyText?a(t.text(),function(e){if(0===(n=t.headers.get("Content-Type")||"").indexOf("application/json")||function(t){var e=t.match(/^\s*(\[|\{)/);return e&&{"[":/]\s*$/,"{":/}\s*$/}[e[1]].test(t)}(e))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t}):t})},form:function(t,e){!function(t){return"undefined"!=typeof FormData&&t instanceof FormData}(t.body)?s(t.body)&&t.emulateJSON&&(t.body=b.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded")):t.headers.delete("Content-Type"),e()},header:function(t,e){f(L({},O.headers.common,t.crossOrigin?{}:O.headers.custom,O.headers[o(t.method)]),function(e,n){t.headers.has(n)||t.headers.set(n,e)}),e()},cors:function(t,e){if(q){var n=b.parse(location.href),o=b.parse(t.getUrl());o.protocol===n.protocol&&o.host===n.host||(t.crossOrigin=!0,t.emulateHTTP=!1,B||(t.client=w))}e()}},O.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(t){O[t]=function(e,n){return this(L(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){O[t]=function(e,n,o){return this(L(o||{},{url:e,method:t,body:n}))}}),P.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(C),C}); \ No newline at end of file diff --git a/package.json b/package.json index 2066ff54..a52f67db 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "vue-resource", - "version": "1.3.4", + "version": "1.3.5", "main": "dist/vue-resource.common.js", - "module": "dist/vue-resource.es2015.js", + "module": "dist/vue-resource.esm.js", "unpkg": "dist/vue-resource.min.js", "jsdelivr": "dist/vue-resource.min.js", "description": "The HTTP client for Vue.js",