From 538e1ca18a88322288296ab5cfc67fc0ab86935b Mon Sep 17 00:00:00 2001 From: Steffan Date: Fri, 16 Sep 2016 10:07:25 +0200 Subject: [PATCH 1/3] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ad3556f..32325782 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ bower install vue-resource ``` ### CDN -Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.0.2/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [npmcdn](https://npmcdn.com/vue-resource@1.0.2/dist/vue-resource.min.js). +Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.0.2/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/vue-resource@1.0.2/dist/vue-resource.min.js). ```html ``` From 4adbc270a8626c95d785367b36bc7869d0530b60 Mon Sep 17 00:00:00 2001 From: Steffan Date: Fri, 23 Sep 2016 10:20:03 +0200 Subject: [PATCH 2/3] fix IE9 xdr issue #386 --- src/http/client/jsonp.js | 8 ++++---- src/http/client/xdr.js | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/http/client/jsonp.js b/src/http/client/jsonp.js index 4f6be467..87dba2c1 100644 --- a/src/http/client/jsonp.js +++ b/src/http/client/jsonp.js @@ -9,14 +9,14 @@ export default function (request) { var name = request.jsonp || 'callback', callback = '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script; - handler = (event) => { + handler = ({type}) => { var status = 0; - if (event.type === 'load' && body !== null) { + if (type === 'load' && body !== null) { status = 200; - } else if (event.type === 'error') { - status = 404; + } else if (type === 'error') { + status = 500; } resolve(request.respondWith(body, {status})); diff --git a/src/http/client/xdr.js b/src/http/client/xdr.js index f67912e2..6d35339e 100644 --- a/src/http/client/xdr.js +++ b/src/http/client/xdr.js @@ -7,25 +7,26 @@ import Promise from '../../promise'; export default function (request) { return new Promise((resolve) => { - var xdr = new XDomainRequest(), handler = (event) => { + var xdr = new XDomainRequest(), handler = ({type}) => { - var response = request.respondWith( - xdr.responseText, { - status: xdr.status, - statusText: xdr.statusText - } - ); + var status = 0; - resolve(response); + if (type === 'load') { + status = 200; + } else if (type === 'error') { + status = 500; + } + + resolve(request.respondWith(xdr.responseText, {status})); }; request.abort = () => xdr.abort(); - xdr.open(request.method, request.getUrl(), true); + xdr.open(request.method, request.getUrl()); xdr.timeout = 0; xdr.onload = handler; xdr.onerror = handler; - xdr.ontimeout = () => {}; + xdr.ontimeout = handler; xdr.onprogress = () => {}; xdr.send(request.getBody()); }); From 393211a8b7a2ecd41436a7f171f3ca239ae19307 Mon Sep 17 00:00:00 2001 From: Steffan Date: Fri, 23 Sep 2016 10:30:46 +0200 Subject: [PATCH 3/3] v1.0.3 --- README.md | 4 ++-- bower.json | 2 +- dist/vue-resource.common.js | 33 ++++++++++++++++++++------------- dist/vue-resource.es2015.js | 33 ++++++++++++++++++++------------- dist/vue-resource.js | 33 ++++++++++++++++++++------------- dist/vue-resource.min.js | 4 ++-- package.json | 2 +- 7 files changed, 66 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 32325782..980c4e40 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ $ bower install vue-resource ``` ### CDN -Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.0.2/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/vue-resource@1.0.2/dist/vue-resource.min.js). +Available on [jsdelivr](https://cdn.jsdelivr.net/vue.resource/1.0.3/vue-resource.min.js), [cdnjs](https://cdnjs.com/libraries/vue-resource) or [unpkg](https://unpkg.com/vue-resource@1.0.3/dist/vue-resource.min.js). ```html - + ``` ## Example diff --git a/bower.json b/bower.json index 064069ea..a30a0bd8 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "vue-resource", "main": "dist/vue-resource.js", - "version": "1.0.2", + "version": "1.0.3", "description": "The HTTP client for Vue.js", "homepage": "https://github.com/vuejs/vue-resource", "license": "MIT", diff --git a/dist/vue-resource.common.js b/dist/vue-resource.common.js index 9d9a256e..b792ef01 100644 --- a/dist/vue-resource.common.js +++ b/dist/vue-resource.common.js @@ -1,5 +1,5 @@ /*! - * vue-resource v1.0.2 + * vue-resource v1.0.3 * https://github.com/vuejs/vue-resource * Released under the MIT License. */ @@ -770,25 +770,30 @@ function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), - handler = function (event) { + handler = function (_ref) { + var type = _ref.type; - var response = request.respondWith(xdr.responseText, { - status: xdr.status, - statusText: xdr.statusText - }); - resolve(response); + var status = 0; + + if (type === 'load') { + status = 200; + } else if (type === 'error') { + status = 500; + } + + resolve(request.respondWith(xdr.responseText, { status: status })); }; request.abort = function () { return xdr.abort(); }; - xdr.open(request.method, request.getUrl(), true); + xdr.open(request.method, request.getUrl()); xdr.timeout = 0; xdr.onload = handler; xdr.onerror = handler; - xdr.ontimeout = function () {}; + xdr.ontimeout = handler; xdr.onprogress = function () {}; xdr.send(request.getBody()); }); @@ -889,14 +894,16 @@ function jsonpClient (request) { handler, script; - handler = function (event) { + handler = function (_ref) { + var type = _ref.type; + var status = 0; - if (event.type === 'load' && body !== null) { + if (type === 'load' && body !== null) { status = 200; - } else if (event.type === 'error') { - status = 404; + } else if (type === 'error') { + status = 500; } resolve(request.respondWith(body, { status: status })); diff --git a/dist/vue-resource.es2015.js b/dist/vue-resource.es2015.js index 72ae3ca6..b445e4dd 100644 --- a/dist/vue-resource.es2015.js +++ b/dist/vue-resource.es2015.js @@ -1,5 +1,5 @@ /*! - * vue-resource v1.0.2 + * vue-resource v1.0.3 * https://github.com/vuejs/vue-resource * Released under the MIT License. */ @@ -768,25 +768,30 @@ function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), - handler = function (event) { + handler = function (_ref) { + var type = _ref.type; - var response = request.respondWith(xdr.responseText, { - status: xdr.status, - statusText: xdr.statusText - }); - resolve(response); + var status = 0; + + if (type === 'load') { + status = 200; + } else if (type === 'error') { + status = 500; + } + + resolve(request.respondWith(xdr.responseText, { status: status })); }; request.abort = function () { return xdr.abort(); }; - xdr.open(request.method, request.getUrl(), true); + xdr.open(request.method, request.getUrl()); xdr.timeout = 0; xdr.onload = handler; xdr.onerror = handler; - xdr.ontimeout = function () {}; + xdr.ontimeout = handler; xdr.onprogress = function () {}; xdr.send(request.getBody()); }); @@ -887,14 +892,16 @@ function jsonpClient (request) { handler, script; - handler = function (event) { + handler = function (_ref) { + var type = _ref.type; + var status = 0; - if (event.type === 'load' && body !== null) { + if (type === 'load' && body !== null) { status = 200; - } else if (event.type === 'error') { - status = 404; + } else if (type === 'error') { + status = 500; } resolve(request.respondWith(body, { status: status })); diff --git a/dist/vue-resource.js b/dist/vue-resource.js index 3d6072d7..2937451d 100644 --- a/dist/vue-resource.js +++ b/dist/vue-resource.js @@ -1,5 +1,5 @@ /*! - * vue-resource v1.0.2 + * vue-resource v1.0.3 * https://github.com/vuejs/vue-resource * Released under the MIT License. */ @@ -774,25 +774,30 @@ function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), - handler = function (event) { + handler = function (_ref) { + var type = _ref.type; - var response = request.respondWith(xdr.responseText, { - status: xdr.status, - statusText: xdr.statusText - }); - resolve(response); + var status = 0; + + if (type === 'load') { + status = 200; + } else if (type === 'error') { + status = 500; + } + + resolve(request.respondWith(xdr.responseText, { status: status })); }; request.abort = function () { return xdr.abort(); }; - xdr.open(request.method, request.getUrl(), true); + xdr.open(request.method, request.getUrl()); xdr.timeout = 0; xdr.onload = handler; xdr.onerror = handler; - xdr.ontimeout = function () {}; + xdr.ontimeout = handler; xdr.onprogress = function () {}; xdr.send(request.getBody()); }); @@ -893,14 +898,16 @@ function jsonpClient (request) { handler, script; - handler = function (event) { + handler = function (_ref) { + var type = _ref.type; + var status = 0; - if (event.type === 'load' && body !== null) { + if (type === 'load' && body !== null) { status = 200; - } else if (event.type === 'error') { - status = 404; + } else if (type === 'error') { + status = 500; } resolve(request.respondWith(body, { status: status })); diff --git a/dist/vue-resource.min.js b/dist/vue-resource.min.js index 33696e57..5a6f05f7 100644 --- a/dist/vue-resource.min.js +++ b/dist/vue-resource.min.js @@ -1,7 +1,7 @@ /*! - * vue-resource v1.0.2 + * vue-resource v1.0.3 * https://github.com/vuejs/vue-resource * Released under the MIT License. */ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.VueResource=n()}(this,function(){"use strict";function t(t){this.state=it,this.value=void 0,this.deferred=[];var n=this;try{t(function(t){n.resolve(t)},function(t){n.reject(t)})}catch(t){n.reject(t)}}function n(t,n){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(n)),this.context=n}function e(t){at=t.util,ct=t.config.debug||!t.config.silent}function o(t){"undefined"!=typeof console&&ct&&console.warn("[VueResource warn]: "+t)}function r(t){"undefined"!=typeof console&&console.error(t)}function i(t,n){return at.nextTick(t,n)}function u(t){return t.replace(/^\s*|\s*$/g,"")}function s(t){return t?t.toLowerCase():""}function c(t){return t?t.toUpperCase():""}function a(t){return"string"==typeof t}function f(t){return t===!0||t===!1}function h(t){return"function"==typeof t}function p(t){return null!==t&&"object"==typeof t}function l(t){return p(t)&&Object.getPrototypeOf(t)==Object.prototype}function d(t){return"undefined"!=typeof Blob&&t instanceof Blob}function m(t){return"undefined"!=typeof FormData&&t instanceof FormData}function y(t,e,o){var r=n.resolve(t);return arguments.length<2?r:r.then(e,o)}function v(t,n,e){return e=e||{},h(e)&&(e=e.call(n)),g(t.bind({$vm:n,$options:e}),t,{$options:e})}function b(t,n){var e,o;if(t&&"number"==typeof t.length)for(e=0;e=200&&i<300,this.status=i||0,this.statusText=u||"",this.headers=new bt(r),this.body=n,a(n)?this.bodyText=n:d(n)&&(this.bodyBlob=n,Y(n)&&(this.bodyText=Q(n)))}return t.prototype.blob=function(){return y(this.bodyBlob)},t.prototype.text=function(){return y(this.bodyText)},t.prototype.json=function(){return y(this.text(),function(t){return JSON.parse(t)})},t}(),wt=function(){function t(n){vt(this,t),this.body=null,this.params={},pt(this,n,{method:c(n.method||"GET")}),this.headers instanceof bt||(this.headers=new bt(this.headers))}return t.prototype.getUrl=function(){return k(this)},t.prototype.getBody=function(){return this.body},t.prototype.respondWith=function(t,n){return new gt(t,pt(n||{},{url:this.getUrl()}))},t}(),Tt={"X-Requested-With":"XMLHttpRequest"},xt={Accept:"application/json, text/plain, */*"},jt={"Content-Type":"application/json;charset=utf-8"};return Z.options={},Z.headers={put:jt,post:jt,patch:jt,delete:jt,custom:Tt,common:xt},Z.interceptors=[M,W,X,B,D,F,N],["get","delete","head","jsonp"].forEach(function(t){Z[t]=function(n,e){return this(pt(e||{},{url:n,method:t}))}}),["post","put","patch"].forEach(function(t){Z[t]=function(n,e,o){return this(pt(o||{},{url:n,method:t,body:e}))}}),tt.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(et),et}); \ No newline at end of file +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.VueResource=n()}(this,function(){"use strict";function t(t){this.state=it,this.value=void 0,this.deferred=[];var n=this;try{t(function(t){n.resolve(t)},function(t){n.reject(t)})}catch(t){n.reject(t)}}function n(t,n){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(n)),this.context=n}function e(t){at=t.util,ct=t.config.debug||!t.config.silent}function o(t){"undefined"!=typeof console&&ct&&console.warn("[VueResource warn]: "+t)}function r(t){"undefined"!=typeof console&&console.error(t)}function i(t,n){return at.nextTick(t,n)}function u(t){return t.replace(/^\s*|\s*$/g,"")}function s(t){return t?t.toLowerCase():""}function c(t){return t?t.toUpperCase():""}function a(t){return"string"==typeof t}function f(t){return t===!0||t===!1}function h(t){return"function"==typeof t}function p(t){return null!==t&&"object"==typeof t}function l(t){return p(t)&&Object.getPrototypeOf(t)==Object.prototype}function d(t){return"undefined"!=typeof Blob&&t instanceof Blob}function m(t){return"undefined"!=typeof FormData&&t instanceof FormData}function y(t,e,o){var r=n.resolve(t);return arguments.length<2?r:r.then(e,o)}function v(t,n,e){return e=e||{},h(e)&&(e=e.call(n)),g(t.bind({$vm:n,$options:e}),t,{$options:e})}function b(t,n){var e,o;if(t&&"number"==typeof t.length)for(e=0;e=200&&i<300,this.status=i||0,this.statusText=u||"",this.headers=new bt(r),this.body=n,a(n)?this.bodyText=n:d(n)&&(this.bodyBlob=n,Y(n)&&(this.bodyText=Q(n)))}return t.prototype.blob=function(){return y(this.bodyBlob)},t.prototype.text=function(){return y(this.bodyText)},t.prototype.json=function(){return y(this.text(),function(t){return JSON.parse(t)})},t}(),wt=function(){function t(n){vt(this,t),this.body=null,this.params={},pt(this,n,{method:c(n.method||"GET")}),this.headers instanceof bt||(this.headers=new bt(this.headers))}return t.prototype.getUrl=function(){return k(this)},t.prototype.getBody=function(){return this.body},t.prototype.respondWith=function(t,n){return new gt(t,pt(n||{},{url:this.getUrl()}))},t}(),Tt={"X-Requested-With":"XMLHttpRequest"},xt={Accept:"application/json, text/plain, */*"},jt={"Content-Type":"application/json;charset=utf-8"};return Z.options={},Z.headers={put:jt,post:jt,patch:jt,delete:jt,custom:Tt,common:xt},Z.interceptors=[M,W,X,B,D,F,N],["get","delete","head","jsonp"].forEach(function(t){Z[t]=function(n,e){return this(pt(e||{},{url:n,method:t}))}}),["post","put","patch"].forEach(function(t){Z[t]=function(n,e,o){return this(pt(o||{},{url:n,method:t,body:e}))}}),tt.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(et),et}); \ No newline at end of file diff --git a/package.json b/package.json index 232e2915..e8e37445 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-resource", - "version": "1.0.2", + "version": "1.0.3", "main": "dist/vue-resource.common.js", "jsnext:main": "dist/vue-resource.es2015.js", "description": "The HTTP client for Vue.js",