axios_rails 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/app/assets/javascripts/axios.js +105 -55
- data/app/assets/javascripts/axios.min.js +2 -2
- data/lib/axios_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69131ae1e6e92122dce6842a00388066fa0ef287
|
4
|
+
data.tar.gz: 19fe44aaf383fb70a7acf0c0f5b1b2bceeaecb44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e9dab51af50a8d4a8bc4f150f44753461e846ae845fc4cf738a5a79bbc8abbb836bbf4172d1dc6974160c2b4a8383c27a45d0d7ad24556c84d77000f9d8e827
|
7
|
+
data.tar.gz: 96fabcfcc4f68772296327b3f9dbc14ed054a1a545e96b089c8ac5765eed738d91bc7a0133c31cf95a60a8d8c1b3b72ede63902c59cbcd4e0c9b31022657fe06
|
data/README.md
CHANGED
@@ -26,6 +26,12 @@ Add it to your JavaScript manifest file:
|
|
26
26
|
|
27
27
|
//= require axios
|
28
28
|
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
+
|
29
35
|
## Contributing
|
30
36
|
|
31
37
|
Bug reports and pull requests are welcome on GitHub at https://github.com/katherineMuedas/axios_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* axios v0.7.0 | (c) 2015 by Matt Zabriskie */
|
1
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
2
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
3
4
|
module.exports = factory();
|
@@ -67,10 +68,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
67
68
|
var dispatchRequest = __webpack_require__(4);
|
68
69
|
var InterceptorManager = __webpack_require__(12);
|
69
70
|
|
70
|
-
var axios = module.exports = function
|
71
|
+
var axios = module.exports = function (config) {
|
72
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
73
|
+
if (typeof config === 'string') {
|
74
|
+
config = utils.merge({
|
75
|
+
url: arguments[0]
|
76
|
+
}, arguments[1]);
|
77
|
+
}
|
78
|
+
|
71
79
|
config = utils.merge({
|
72
80
|
method: 'get',
|
73
81
|
headers: {},
|
82
|
+
timeout: defaults.timeout,
|
74
83
|
transformRequest: defaults.transformRequest,
|
75
84
|
transformResponse: defaults.transformResponse
|
76
85
|
}, config);
|
@@ -356,6 +365,27 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
356
365
|
return toString.call(val) === '[object Arguments]';
|
357
366
|
}
|
358
367
|
|
368
|
+
/**
|
369
|
+
* Determine if we're running in a standard browser environment
|
370
|
+
*
|
371
|
+
* This allows axios to run in a web worker, and react-native.
|
372
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
373
|
+
*
|
374
|
+
* web workers:
|
375
|
+
* typeof window -> undefined
|
376
|
+
* typeof document -> undefined
|
377
|
+
*
|
378
|
+
* react-native:
|
379
|
+
* typeof document.createelement -> undefined
|
380
|
+
*/
|
381
|
+
function isStandardBrowserEnv() {
|
382
|
+
return (
|
383
|
+
typeof window !== 'undefined' &&
|
384
|
+
typeof document !== 'undefined' &&
|
385
|
+
typeof document.createElement === 'function'
|
386
|
+
);
|
387
|
+
}
|
388
|
+
|
359
389
|
/**
|
360
390
|
* Iterate over an Array or an Object invoking a function for each item.
|
361
391
|
*
|
@@ -437,6 +467,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
437
467
|
isDate: isDate,
|
438
468
|
isFile: isFile,
|
439
469
|
isBlob: isBlob,
|
470
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
440
471
|
forEach: forEach,
|
441
472
|
merge: merge,
|
442
473
|
trim: trim
|
@@ -584,10 +615,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
584
615
|
var defaults = __webpack_require__(2);
|
585
616
|
var utils = __webpack_require__(3);
|
586
617
|
var buildUrl = __webpack_require__(7);
|
587
|
-
var
|
588
|
-
var
|
589
|
-
var transformData = __webpack_require__(10);
|
590
|
-
var urlIsSameOrigin = __webpack_require__(11);
|
618
|
+
var parseHeaders = __webpack_require__(8);
|
619
|
+
var transformData = __webpack_require__(9);
|
591
620
|
|
592
621
|
module.exports = function xhrAdapter(resolve, reject, config) {
|
593
622
|
// Transform request data
|
@@ -644,11 +673,20 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
644
673
|
};
|
645
674
|
|
646
675
|
// Add xsrf header
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
676
|
+
// This is only done if running in a standard browser environment.
|
677
|
+
// Specifically not if we're in a web worker, or react-native.
|
678
|
+
if (utils.isStandardBrowserEnv()) {
|
679
|
+
var cookies = __webpack_require__(10);
|
680
|
+
var urlIsSameOrigin = __webpack_require__(11);
|
681
|
+
|
682
|
+
// Add xsrf header
|
683
|
+
var xsrfValue = urlIsSameOrigin(config.url) ?
|
684
|
+
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) :
|
685
|
+
undefined;
|
686
|
+
|
687
|
+
if (xsrfValue) {
|
688
|
+
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue;
|
689
|
+
}
|
652
690
|
}
|
653
691
|
|
654
692
|
// Add headers to the request
|
@@ -761,49 +799,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
761
799
|
|
762
800
|
var utils = __webpack_require__(3);
|
763
801
|
|
764
|
-
module.exports = {
|
765
|
-
write: function write(name, value, expires, path, domain, secure) {
|
766
|
-
var cookie = [];
|
767
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
768
|
-
|
769
|
-
if (utils.isNumber(expires)) {
|
770
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
771
|
-
}
|
772
|
-
|
773
|
-
if (utils.isString(path)) {
|
774
|
-
cookie.push('path=' + path);
|
775
|
-
}
|
776
|
-
|
777
|
-
if (utils.isString(domain)) {
|
778
|
-
cookie.push('domain=' + domain);
|
779
|
-
}
|
780
|
-
|
781
|
-
if (secure === true) {
|
782
|
-
cookie.push('secure');
|
783
|
-
}
|
784
|
-
|
785
|
-
document.cookie = cookie.join('; ');
|
786
|
-
},
|
787
|
-
|
788
|
-
read: function read(name) {
|
789
|
-
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
790
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
791
|
-
},
|
792
|
-
|
793
|
-
remove: function remove(name) {
|
794
|
-
this.write(name, '', Date.now() - 86400000);
|
795
|
-
}
|
796
|
-
};
|
797
|
-
|
798
|
-
|
799
|
-
/***/ },
|
800
|
-
/* 9 */
|
801
|
-
/***/ function(module, exports, __webpack_require__) {
|
802
|
-
|
803
|
-
'use strict';
|
804
|
-
|
805
|
-
var utils = __webpack_require__(3);
|
806
|
-
|
807
802
|
/**
|
808
803
|
* Parse headers into an object
|
809
804
|
*
|
@@ -837,7 +832,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
837
832
|
|
838
833
|
|
839
834
|
/***/ },
|
840
|
-
/*
|
835
|
+
/* 9 */
|
841
836
|
/***/ function(module, exports, __webpack_require__) {
|
842
837
|
|
843
838
|
'use strict';
|
@@ -861,12 +856,67 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
861
856
|
};
|
862
857
|
|
863
858
|
|
859
|
+
/***/ },
|
860
|
+
/* 10 */
|
861
|
+
/***/ function(module, exports, __webpack_require__) {
|
862
|
+
|
863
|
+
'use strict';
|
864
|
+
|
865
|
+
/**
|
866
|
+
* WARNING:
|
867
|
+
* This file makes references to objects that aren't safe in all environments.
|
868
|
+
* Please see lib/utils.isStandardBrowserEnv before including this file.
|
869
|
+
*/
|
870
|
+
|
871
|
+
var utils = __webpack_require__(3);
|
872
|
+
|
873
|
+
module.exports = {
|
874
|
+
write: function write(name, value, expires, path, domain, secure) {
|
875
|
+
var cookie = [];
|
876
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
877
|
+
|
878
|
+
if (utils.isNumber(expires)) {
|
879
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
880
|
+
}
|
881
|
+
|
882
|
+
if (utils.isString(path)) {
|
883
|
+
cookie.push('path=' + path);
|
884
|
+
}
|
885
|
+
|
886
|
+
if (utils.isString(domain)) {
|
887
|
+
cookie.push('domain=' + domain);
|
888
|
+
}
|
889
|
+
|
890
|
+
if (secure === true) {
|
891
|
+
cookie.push('secure');
|
892
|
+
}
|
893
|
+
|
894
|
+
document.cookie = cookie.join('; ');
|
895
|
+
},
|
896
|
+
|
897
|
+
read: function read(name) {
|
898
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
899
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
900
|
+
},
|
901
|
+
|
902
|
+
remove: function remove(name) {
|
903
|
+
this.write(name, '', Date.now() - 86400000);
|
904
|
+
}
|
905
|
+
};
|
906
|
+
|
907
|
+
|
864
908
|
/***/ },
|
865
909
|
/* 11 */
|
866
910
|
/***/ function(module, exports, __webpack_require__) {
|
867
911
|
|
868
912
|
'use strict';
|
869
913
|
|
914
|
+
/**
|
915
|
+
* WARNING:
|
916
|
+
* This file makes references to objects that aren't safe in all environments.
|
917
|
+
* Please see lib/utils.isStandardBrowserEnv before including this file.
|
918
|
+
*/
|
919
|
+
|
870
920
|
var utils = __webpack_require__(3);
|
871
921
|
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
872
922
|
var urlParsingNode = document.createElement('a');
|
@@ -1005,7 +1055,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1005
1055
|
*/
|
1006
1056
|
module.exports = function spread(callback) {
|
1007
1057
|
return function (arr) {
|
1008
|
-
callback.apply(null, arr);
|
1058
|
+
return callback.apply(null, arr);
|
1009
1059
|
};
|
1010
1060
|
};
|
1011
1061
|
|
@@ -1,3 +1,3 @@
|
|
1
|
-
/* axios v0.
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(
|
1
|
+
/* axios v0.7.0 | (c) 2015 by Matt Zabriskie */
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";var r=n(2),o=n(3),i=n(4),s=n(12),u=e.exports=function(e){"string"==typeof e&&(e=o.merge({url:arguments[0]},arguments[1])),e=o.merge({method:"get",headers:{},timeout:r.timeout,transformRequest:r.transformRequest,transformResponse:r.transformResponse},e),e.withCredentials=e.withCredentials||r.withCredentials;var t=[i,void 0],n=Promise.resolve(e);for(u.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),u.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n};u.defaults=r,u.all=function(e){return Promise.all(e)},u.spread=n(13),u.interceptors={request:new s,response:new s},function(){function e(){o.forEach(arguments,function(e){u[e]=function(t,n){return u(o.merge(n||{},{method:e,url:t}))}})}function t(){o.forEach(arguments,function(e){u[e]=function(t,n,r){return u(o.merge(r||{},{method:e,url:t,data:n}))}})}e("delete","get","head"),t("post","put","patch")}()},function(e,t,n){"use strict";var r=n(3),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return r.isFormData(e)?e:r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(r.isUndefined(t)||(r.forEach(t,function(e,n){"content-type"===n.toLowerCase()&&(t["Content-Type"]=e)}),r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(o,"");try{e=JSON.parse(e)}catch(t){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e,t){"use strict";function n(e){return"[object Array]"===v.call(e)}function r(e){return"[object ArrayBuffer]"===v.call(e)}function o(e){return"[object FormData]"===v.call(e)}function i(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function s(e){return"string"==typeof e}function u(e){return"number"==typeof e}function a(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function c(e){return"[object Date]"===v.call(e)}function p(e){return"[object File]"===v.call(e)}function l(e){return"[object Blob]"===v.call(e)}function d(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(e){return"[object Arguments]"===v.call(e)}function m(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function y(e,t){if(null!==e&&"undefined"!=typeof e){var r=n(e)||h(e);if("object"==typeof e||r||(e=[e]),r)for(var o=0,i=e.length;i>o;o++)t.call(null,e[o],o,e);else for(var s in e)e.hasOwnProperty(s)&&t.call(null,e[s],s,e)}}function g(){var e={};return y(arguments,function(t){y(t,function(t,n){e[n]=t})}),e}var v=Object.prototype.toString;e.exports={isArray:n,isArrayBuffer:r,isFormData:o,isArrayBufferView:i,isString:s,isNumber:u,isObject:f,isUndefined:a,isDate:c,isFile:p,isBlob:l,isStandardBrowserEnv:m,forEach:y,merge:g,trim:d}},function(e,t,n){(function(t){"use strict";e.exports=function(e){return new Promise(function(r,o){try{"undefined"!=typeof XMLHttpRequest||"undefined"!=typeof ActiveXObject?n(6)(r,o,e):"undefined"!=typeof t&&n(6)(r,o,e)}catch(i){o(i)}})}}).call(t,n(5))},function(e,t){function n(){f=!1,s.length?a=s.concat(a):c=-1,a.length&&r()}function r(){if(!f){var e=setTimeout(n);f=!0;for(var t=a.length;t;){for(s=a,a=[];++c<t;)s&&s[c].run();c=-1,t=a.length}s=null,f=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var s,u=e.exports={},a=[],f=!1,c=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new o(e,t)),1!==a.length||f||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=i,u.addListener=i,u.once=i,u.off=i,u.removeListener=i,u.removeAllListeners=i,u.emit=i,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(2),o=n(3),i=n(7),s=n(8),u=n(9);e.exports=function(e,t,a){var f=u(a.data,a.headers,a.transformRequest),c=o.merge(r.headers.common,r.headers[a.method]||{},a.headers||{});o.isFormData(f)&&delete c["Content-Type"];var p=new(XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");if(p.open(a.method.toUpperCase(),i(a.url,a.params),!0),p.timeout=a.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState){var n=s(p.getAllResponseHeaders()),r=-1!==["text",""].indexOf(a.responseType||"")?p.responseText:p.response,o={data:u(r,n,a.transformResponse),status:p.status,statusText:p.statusText,headers:n,config:a};(p.status>=200&&p.status<300?e:t)(o),p=null}},o.isStandardBrowserEnv()){var l=n(10),d=n(11),h=d(a.url)?l.read(a.xsrfCookieName||r.xsrfCookieName):void 0;h&&(c[a.xsrfHeaderName||r.xsrfHeaderName]=h)}if(o.forEach(c,function(e,t){f||"content-type"!==t.toLowerCase()?p.setRequestHeader(t,e):delete c[t]}),a.withCredentials&&(p.withCredentials=!0),a.responseType)try{p.responseType=a.responseType}catch(m){if("json"!==p.responseType)throw m}o.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(3);e.exports=function(e,t){if(!t)return e;var n=[];return o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)&&(t+="[]"),o.isArray(e)||(e=[e]),o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),n.push(r(t)+"="+r(e))}))}),n.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+n.join("&")),e}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e){var t,n,o,i={};return e?(r.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t&&(i[t]=i[t]?i[t]+", "+n:n)}),i):i}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";var r=n(3);e.exports={write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}},function(e,t,n){"use strict";function r(e){var t=e;return s&&(u.setAttribute("href",t),t=u.href),u.setAttribute("href",t),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o,i=n(3),s=/(msie|trident)/i.test(navigator.userAgent),u=document.createElement("a");o=r(window.location.href),e.exports=function(e){var t=i.isString(e)?r(e):e;return t.protocol===o.protocol&&t.host===o.host}},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])});
|
3
3
|
//# sourceMappingURL=axios.min.map
|
data/lib/axios_rails/version.rb
CHANGED