axios_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/axios.js +1067 -0
- data/app/assets/javascripts/axios.min.js +3 -0
- data/axios_rails.gemspec +28 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/axios_rails/engine.rb +6 -0
- data/lib/axios_rails/version.rb +3 -0
- data/lib/axios_rails.rb +6 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fee85e489d8d526a13c37bc699ef94846f8fe63c
|
4
|
+
data.tar.gz: 10b85c45a3ee38c5258f5931eace004d84eaadb9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 82a08c9294ec9e21046e69e17a2dde2f5f7a8c50267b5d685494246b23d67b3bac2a40598167e97f134c05f1b8561c571ef3b5d41d59e6ac2d078adb5cc00c23
|
7
|
+
data.tar.gz: fb556b080c7fc7a5ef4acbc7998245d7a08e14d1fd0fab9dd4758df7c78a8dc899760510f0a9169b5607fa23a912682ffa128a649789435c186601a098546d3d
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Katherine Adam
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# AxiosRails
|
2
|
+
|
3
|
+
Do you like [Axios](https://github.com/mzabriskie/axios)? Now it is ready to use it in your Rails apps.
|
4
|
+
|
5
|
+
##Version
|
6
|
+
|
7
|
+
The latest version of this gem bundles axios v0.7.0.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Adds to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'axios_rails'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle install
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install axios_rails
|
24
|
+
|
25
|
+
Add it to your JavaScript manifest file:
|
26
|
+
|
27
|
+
//= require axios
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
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.
|
32
|
+
|
33
|
+
|
34
|
+
## License
|
35
|
+
|
36
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
37
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,1067 @@
|
|
1
|
+
/* axios v0.7.0 | (c) 2015 by Matt Zabriskie */
|
2
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
3
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
4
|
+
module.exports = factory();
|
5
|
+
else if(typeof define === 'function' && define.amd)
|
6
|
+
define([], factory);
|
7
|
+
else if(typeof exports === 'object')
|
8
|
+
exports["axios"] = factory();
|
9
|
+
else
|
10
|
+
root["axios"] = factory();
|
11
|
+
})(this, function() {
|
12
|
+
return /******/ (function(modules) { // webpackBootstrap
|
13
|
+
/******/ // The module cache
|
14
|
+
/******/ var installedModules = {};
|
15
|
+
/******/
|
16
|
+
/******/ // The require function
|
17
|
+
/******/ function __webpack_require__(moduleId) {
|
18
|
+
/******/
|
19
|
+
/******/ // Check if module is in cache
|
20
|
+
/******/ if(installedModules[moduleId])
|
21
|
+
/******/ return installedModules[moduleId].exports;
|
22
|
+
/******/
|
23
|
+
/******/ // Create a new module (and put it into the cache)
|
24
|
+
/******/ var module = installedModules[moduleId] = {
|
25
|
+
/******/ exports: {},
|
26
|
+
/******/ id: moduleId,
|
27
|
+
/******/ loaded: false
|
28
|
+
/******/ };
|
29
|
+
/******/
|
30
|
+
/******/ // Execute the module function
|
31
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
32
|
+
/******/
|
33
|
+
/******/ // Flag the module as loaded
|
34
|
+
/******/ module.loaded = true;
|
35
|
+
/******/
|
36
|
+
/******/ // Return the exports of the module
|
37
|
+
/******/ return module.exports;
|
38
|
+
/******/ }
|
39
|
+
/******/
|
40
|
+
/******/
|
41
|
+
/******/ // expose the modules object (__webpack_modules__)
|
42
|
+
/******/ __webpack_require__.m = modules;
|
43
|
+
/******/
|
44
|
+
/******/ // expose the module cache
|
45
|
+
/******/ __webpack_require__.c = installedModules;
|
46
|
+
/******/
|
47
|
+
/******/ // __webpack_public_path__
|
48
|
+
/******/ __webpack_require__.p = "";
|
49
|
+
/******/
|
50
|
+
/******/ // Load entry module and return exports
|
51
|
+
/******/ return __webpack_require__(0);
|
52
|
+
/******/ })
|
53
|
+
/************************************************************************/
|
54
|
+
/******/ ([
|
55
|
+
/* 0 */
|
56
|
+
/***/ function(module, exports, __webpack_require__) {
|
57
|
+
|
58
|
+
module.exports = __webpack_require__(1);
|
59
|
+
|
60
|
+
/***/ },
|
61
|
+
/* 1 */
|
62
|
+
/***/ function(module, exports, __webpack_require__) {
|
63
|
+
|
64
|
+
'use strict';
|
65
|
+
|
66
|
+
var defaults = __webpack_require__(2);
|
67
|
+
var utils = __webpack_require__(3);
|
68
|
+
var dispatchRequest = __webpack_require__(4);
|
69
|
+
var InterceptorManager = __webpack_require__(12);
|
70
|
+
|
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
|
+
|
79
|
+
config = utils.merge({
|
80
|
+
method: 'get',
|
81
|
+
headers: {},
|
82
|
+
timeout: defaults.timeout,
|
83
|
+
transformRequest: defaults.transformRequest,
|
84
|
+
transformResponse: defaults.transformResponse
|
85
|
+
}, config);
|
86
|
+
|
87
|
+
// Don't allow overriding defaults.withCredentials
|
88
|
+
config.withCredentials = config.withCredentials || defaults.withCredentials;
|
89
|
+
|
90
|
+
// Hook up interceptors middleware
|
91
|
+
var chain = [dispatchRequest, undefined];
|
92
|
+
var promise = Promise.resolve(config);
|
93
|
+
|
94
|
+
axios.interceptors.request.forEach(function (interceptor) {
|
95
|
+
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
96
|
+
});
|
97
|
+
|
98
|
+
axios.interceptors.response.forEach(function (interceptor) {
|
99
|
+
chain.push(interceptor.fulfilled, interceptor.rejected);
|
100
|
+
});
|
101
|
+
|
102
|
+
while (chain.length) {
|
103
|
+
promise = promise.then(chain.shift(), chain.shift());
|
104
|
+
}
|
105
|
+
|
106
|
+
return promise;
|
107
|
+
};
|
108
|
+
|
109
|
+
// Expose defaults
|
110
|
+
axios.defaults = defaults;
|
111
|
+
|
112
|
+
// Expose all/spread
|
113
|
+
axios.all = function (promises) {
|
114
|
+
return Promise.all(promises);
|
115
|
+
};
|
116
|
+
axios.spread = __webpack_require__(13);
|
117
|
+
|
118
|
+
// Expose interceptors
|
119
|
+
axios.interceptors = {
|
120
|
+
request: new InterceptorManager(),
|
121
|
+
response: new InterceptorManager()
|
122
|
+
};
|
123
|
+
|
124
|
+
// Provide aliases for supported request methods
|
125
|
+
(function () {
|
126
|
+
function createShortMethods() {
|
127
|
+
utils.forEach(arguments, function (method) {
|
128
|
+
axios[method] = function (url, config) {
|
129
|
+
return axios(utils.merge(config || {}, {
|
130
|
+
method: method,
|
131
|
+
url: url
|
132
|
+
}));
|
133
|
+
};
|
134
|
+
});
|
135
|
+
}
|
136
|
+
|
137
|
+
function createShortMethodsWithData() {
|
138
|
+
utils.forEach(arguments, function (method) {
|
139
|
+
axios[method] = function (url, data, config) {
|
140
|
+
return axios(utils.merge(config || {}, {
|
141
|
+
method: method,
|
142
|
+
url: url,
|
143
|
+
data: data
|
144
|
+
}));
|
145
|
+
};
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
createShortMethods('delete', 'get', 'head');
|
150
|
+
createShortMethodsWithData('post', 'put', 'patch');
|
151
|
+
})();
|
152
|
+
|
153
|
+
|
154
|
+
/***/ },
|
155
|
+
/* 2 */
|
156
|
+
/***/ function(module, exports, __webpack_require__) {
|
157
|
+
|
158
|
+
'use strict';
|
159
|
+
|
160
|
+
var utils = __webpack_require__(3);
|
161
|
+
|
162
|
+
var PROTECTION_PREFIX = /^\)\]\}',?\n/;
|
163
|
+
var DEFAULT_CONTENT_TYPE = {
|
164
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
165
|
+
};
|
166
|
+
|
167
|
+
module.exports = {
|
168
|
+
transformRequest: [function (data, headers) {
|
169
|
+
if(utils.isFormData(data)) {
|
170
|
+
return data;
|
171
|
+
}
|
172
|
+
if (utils.isArrayBuffer(data)) {
|
173
|
+
return data;
|
174
|
+
}
|
175
|
+
if (utils.isArrayBufferView(data)) {
|
176
|
+
return data.buffer;
|
177
|
+
}
|
178
|
+
if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
|
179
|
+
// Set application/json if no Content-Type has been specified
|
180
|
+
if (!utils.isUndefined(headers)) {
|
181
|
+
utils.forEach(headers, function (val, key) {
|
182
|
+
if (key.toLowerCase() === 'content-type') {
|
183
|
+
headers['Content-Type'] = val;
|
184
|
+
}
|
185
|
+
});
|
186
|
+
|
187
|
+
if (utils.isUndefined(headers['Content-Type'])) {
|
188
|
+
headers['Content-Type'] = 'application/json;charset=utf-8';
|
189
|
+
}
|
190
|
+
}
|
191
|
+
return JSON.stringify(data);
|
192
|
+
}
|
193
|
+
return data;
|
194
|
+
}],
|
195
|
+
|
196
|
+
transformResponse: [function (data) {
|
197
|
+
if (typeof data === 'string') {
|
198
|
+
data = data.replace(PROTECTION_PREFIX, '');
|
199
|
+
try {
|
200
|
+
data = JSON.parse(data);
|
201
|
+
} catch (e) { /* Ignore */ }
|
202
|
+
}
|
203
|
+
return data;
|
204
|
+
}],
|
205
|
+
|
206
|
+
headers: {
|
207
|
+
common: {
|
208
|
+
'Accept': 'application/json, text/plain, */*'
|
209
|
+
},
|
210
|
+
patch: utils.merge(DEFAULT_CONTENT_TYPE),
|
211
|
+
post: utils.merge(DEFAULT_CONTENT_TYPE),
|
212
|
+
put: utils.merge(DEFAULT_CONTENT_TYPE)
|
213
|
+
},
|
214
|
+
|
215
|
+
timeout: 0,
|
216
|
+
|
217
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
218
|
+
xsrfHeaderName: 'X-XSRF-TOKEN'
|
219
|
+
};
|
220
|
+
|
221
|
+
|
222
|
+
/***/ },
|
223
|
+
/* 3 */
|
224
|
+
/***/ function(module, exports) {
|
225
|
+
|
226
|
+
'use strict';
|
227
|
+
|
228
|
+
/*global toString:true*/
|
229
|
+
|
230
|
+
// utils is a library of generic helper functions non-specific to axios
|
231
|
+
|
232
|
+
var toString = Object.prototype.toString;
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Determine if a value is an Array
|
236
|
+
*
|
237
|
+
* @param {Object} val The value to test
|
238
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
239
|
+
*/
|
240
|
+
function isArray(val) {
|
241
|
+
return toString.call(val) === '[object Array]';
|
242
|
+
}
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Determine if a value is an ArrayBuffer
|
246
|
+
*
|
247
|
+
* @param {Object} val The value to test
|
248
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
249
|
+
*/
|
250
|
+
function isArrayBuffer(val) {
|
251
|
+
return toString.call(val) === '[object ArrayBuffer]';
|
252
|
+
}
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Determine if a value is a FormData
|
256
|
+
*
|
257
|
+
* @param {Object} val The value to test
|
258
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
259
|
+
*/
|
260
|
+
function isFormData(val) {
|
261
|
+
return toString.call(val) === '[object FormData]';
|
262
|
+
}
|
263
|
+
|
264
|
+
/**
|
265
|
+
* Determine if a value is a view on an ArrayBuffer
|
266
|
+
*
|
267
|
+
* @param {Object} val The value to test
|
268
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
269
|
+
*/
|
270
|
+
function isArrayBufferView(val) {
|
271
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
272
|
+
return ArrayBuffer.isView(val);
|
273
|
+
} else {
|
274
|
+
return (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Determine if a value is a String
|
280
|
+
*
|
281
|
+
* @param {Object} val The value to test
|
282
|
+
* @returns {boolean} True if value is a String, otherwise false
|
283
|
+
*/
|
284
|
+
function isString(val) {
|
285
|
+
return typeof val === 'string';
|
286
|
+
}
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Determine if a value is a Number
|
290
|
+
*
|
291
|
+
* @param {Object} val The value to test
|
292
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
293
|
+
*/
|
294
|
+
function isNumber(val) {
|
295
|
+
return typeof val === 'number';
|
296
|
+
}
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Determine if a value is undefined
|
300
|
+
*
|
301
|
+
* @param {Object} val The value to test
|
302
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
303
|
+
*/
|
304
|
+
function isUndefined(val) {
|
305
|
+
return typeof val === 'undefined';
|
306
|
+
}
|
307
|
+
|
308
|
+
/**
|
309
|
+
* Determine if a value is an Object
|
310
|
+
*
|
311
|
+
* @param {Object} val The value to test
|
312
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
313
|
+
*/
|
314
|
+
function isObject(val) {
|
315
|
+
return val !== null && typeof val === 'object';
|
316
|
+
}
|
317
|
+
|
318
|
+
/**
|
319
|
+
* Determine if a value is a Date
|
320
|
+
*
|
321
|
+
* @param {Object} val The value to test
|
322
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
323
|
+
*/
|
324
|
+
function isDate(val) {
|
325
|
+
return toString.call(val) === '[object Date]';
|
326
|
+
}
|
327
|
+
|
328
|
+
/**
|
329
|
+
* Determine if a value is a File
|
330
|
+
*
|
331
|
+
* @param {Object} val The value to test
|
332
|
+
* @returns {boolean} True if value is a File, otherwise false
|
333
|
+
*/
|
334
|
+
function isFile(val) {
|
335
|
+
return toString.call(val) === '[object File]';
|
336
|
+
}
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Determine if a value is a Blob
|
340
|
+
*
|
341
|
+
* @param {Object} val The value to test
|
342
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
343
|
+
*/
|
344
|
+
function isBlob(val) {
|
345
|
+
return toString.call(val) === '[object Blob]';
|
346
|
+
}
|
347
|
+
|
348
|
+
/**
|
349
|
+
* Trim excess whitespace off the beginning and end of a string
|
350
|
+
*
|
351
|
+
* @param {String} str The String to trim
|
352
|
+
* @returns {String} The String freed of excess whitespace
|
353
|
+
*/
|
354
|
+
function trim(str) {
|
355
|
+
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
356
|
+
}
|
357
|
+
|
358
|
+
/**
|
359
|
+
* Determine if a value is an Arguments object
|
360
|
+
*
|
361
|
+
* @param {Object} val The value to test
|
362
|
+
* @returns {boolean} True if value is an Arguments object, otherwise false
|
363
|
+
*/
|
364
|
+
function isArguments(val) {
|
365
|
+
return toString.call(val) === '[object Arguments]';
|
366
|
+
}
|
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
|
+
|
389
|
+
/**
|
390
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
391
|
+
*
|
392
|
+
* If `obj` is an Array or arguments callback will be called passing
|
393
|
+
* the value, index, and complete array for each item.
|
394
|
+
*
|
395
|
+
* If 'obj' is an Object callback will be called passing
|
396
|
+
* the value, key, and complete object for each property.
|
397
|
+
*
|
398
|
+
* @param {Object|Array} obj The object to iterate
|
399
|
+
* @param {Function} fn The callback to invoke for each item
|
400
|
+
*/
|
401
|
+
function forEach(obj, fn) {
|
402
|
+
// Don't bother if no value provided
|
403
|
+
if (obj === null || typeof obj === 'undefined') {
|
404
|
+
return;
|
405
|
+
}
|
406
|
+
|
407
|
+
// Check if obj is array-like
|
408
|
+
var isArrayLike = isArray(obj) || isArguments(obj);
|
409
|
+
|
410
|
+
// Force an array if not already something iterable
|
411
|
+
if (typeof obj !== 'object' && !isArrayLike) {
|
412
|
+
obj = [obj];
|
413
|
+
}
|
414
|
+
|
415
|
+
// Iterate over array values
|
416
|
+
if (isArrayLike) {
|
417
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
418
|
+
fn.call(null, obj[i], i, obj);
|
419
|
+
}
|
420
|
+
}
|
421
|
+
// Iterate over object keys
|
422
|
+
else {
|
423
|
+
for (var key in obj) {
|
424
|
+
if (obj.hasOwnProperty(key)) {
|
425
|
+
fn.call(null, obj[key], key, obj);
|
426
|
+
}
|
427
|
+
}
|
428
|
+
}
|
429
|
+
}
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Accepts varargs expecting each argument to be an object, then
|
433
|
+
* immutably merges the properties of each object and returns result.
|
434
|
+
*
|
435
|
+
* When multiple objects contain the same key the later object in
|
436
|
+
* the arguments list will take precedence.
|
437
|
+
*
|
438
|
+
* Example:
|
439
|
+
*
|
440
|
+
* ```js
|
441
|
+
* var result = merge({foo: 123}, {foo: 456});
|
442
|
+
* console.log(result.foo); // outputs 456
|
443
|
+
* ```
|
444
|
+
*
|
445
|
+
* @param {Object} obj1 Object to merge
|
446
|
+
* @returns {Object} Result of all merge properties
|
447
|
+
*/
|
448
|
+
function merge(/*obj1, obj2, obj3, ...*/) {
|
449
|
+
var result = {};
|
450
|
+
forEach(arguments, function (obj) {
|
451
|
+
forEach(obj, function (val, key) {
|
452
|
+
result[key] = val;
|
453
|
+
});
|
454
|
+
});
|
455
|
+
return result;
|
456
|
+
}
|
457
|
+
|
458
|
+
module.exports = {
|
459
|
+
isArray: isArray,
|
460
|
+
isArrayBuffer: isArrayBuffer,
|
461
|
+
isFormData: isFormData,
|
462
|
+
isArrayBufferView: isArrayBufferView,
|
463
|
+
isString: isString,
|
464
|
+
isNumber: isNumber,
|
465
|
+
isObject: isObject,
|
466
|
+
isUndefined: isUndefined,
|
467
|
+
isDate: isDate,
|
468
|
+
isFile: isFile,
|
469
|
+
isBlob: isBlob,
|
470
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
471
|
+
forEach: forEach,
|
472
|
+
merge: merge,
|
473
|
+
trim: trim
|
474
|
+
};
|
475
|
+
|
476
|
+
|
477
|
+
/***/ },
|
478
|
+
/* 4 */
|
479
|
+
/***/ function(module, exports, __webpack_require__) {
|
480
|
+
|
481
|
+
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
|
482
|
+
|
483
|
+
/**
|
484
|
+
* Dispatch a request to the server using whichever adapter
|
485
|
+
* is supported by the current environment.
|
486
|
+
*
|
487
|
+
* @param {object} config The config that is to be used for the request
|
488
|
+
* @returns {Promise} The Promise to be fulfilled
|
489
|
+
*/
|
490
|
+
module.exports = function dispatchRequest(config) {
|
491
|
+
return new Promise(function (resolve, reject) {
|
492
|
+
try {
|
493
|
+
// For browsers use XHR adapter
|
494
|
+
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) {
|
495
|
+
__webpack_require__(6)(resolve, reject, config);
|
496
|
+
}
|
497
|
+
// For node use HTTP adapter
|
498
|
+
else if (typeof process !== 'undefined') {
|
499
|
+
__webpack_require__(6)(resolve, reject, config);
|
500
|
+
}
|
501
|
+
} catch (e) {
|
502
|
+
reject(e);
|
503
|
+
}
|
504
|
+
});
|
505
|
+
};
|
506
|
+
|
507
|
+
|
508
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
509
|
+
|
510
|
+
/***/ },
|
511
|
+
/* 5 */
|
512
|
+
/***/ function(module, exports) {
|
513
|
+
|
514
|
+
// shim for using process in browser
|
515
|
+
|
516
|
+
var process = module.exports = {};
|
517
|
+
var queue = [];
|
518
|
+
var draining = false;
|
519
|
+
var currentQueue;
|
520
|
+
var queueIndex = -1;
|
521
|
+
|
522
|
+
function cleanUpNextTick() {
|
523
|
+
draining = false;
|
524
|
+
if (currentQueue.length) {
|
525
|
+
queue = currentQueue.concat(queue);
|
526
|
+
} else {
|
527
|
+
queueIndex = -1;
|
528
|
+
}
|
529
|
+
if (queue.length) {
|
530
|
+
drainQueue();
|
531
|
+
}
|
532
|
+
}
|
533
|
+
|
534
|
+
function drainQueue() {
|
535
|
+
if (draining) {
|
536
|
+
return;
|
537
|
+
}
|
538
|
+
var timeout = setTimeout(cleanUpNextTick);
|
539
|
+
draining = true;
|
540
|
+
|
541
|
+
var len = queue.length;
|
542
|
+
while(len) {
|
543
|
+
currentQueue = queue;
|
544
|
+
queue = [];
|
545
|
+
while (++queueIndex < len) {
|
546
|
+
if (currentQueue) {
|
547
|
+
currentQueue[queueIndex].run();
|
548
|
+
}
|
549
|
+
}
|
550
|
+
queueIndex = -1;
|
551
|
+
len = queue.length;
|
552
|
+
}
|
553
|
+
currentQueue = null;
|
554
|
+
draining = false;
|
555
|
+
clearTimeout(timeout);
|
556
|
+
}
|
557
|
+
|
558
|
+
process.nextTick = function (fun) {
|
559
|
+
var args = new Array(arguments.length - 1);
|
560
|
+
if (arguments.length > 1) {
|
561
|
+
for (var i = 1; i < arguments.length; i++) {
|
562
|
+
args[i - 1] = arguments[i];
|
563
|
+
}
|
564
|
+
}
|
565
|
+
queue.push(new Item(fun, args));
|
566
|
+
if (queue.length === 1 && !draining) {
|
567
|
+
setTimeout(drainQueue, 0);
|
568
|
+
}
|
569
|
+
};
|
570
|
+
|
571
|
+
// v8 likes predictible objects
|
572
|
+
function Item(fun, array) {
|
573
|
+
this.fun = fun;
|
574
|
+
this.array = array;
|
575
|
+
}
|
576
|
+
Item.prototype.run = function () {
|
577
|
+
this.fun.apply(null, this.array);
|
578
|
+
};
|
579
|
+
process.title = 'browser';
|
580
|
+
process.browser = true;
|
581
|
+
process.env = {};
|
582
|
+
process.argv = [];
|
583
|
+
process.version = ''; // empty string to avoid regexp issues
|
584
|
+
process.versions = {};
|
585
|
+
|
586
|
+
function noop() {}
|
587
|
+
|
588
|
+
process.on = noop;
|
589
|
+
process.addListener = noop;
|
590
|
+
process.once = noop;
|
591
|
+
process.off = noop;
|
592
|
+
process.removeListener = noop;
|
593
|
+
process.removeAllListeners = noop;
|
594
|
+
process.emit = noop;
|
595
|
+
|
596
|
+
process.binding = function (name) {
|
597
|
+
throw new Error('process.binding is not supported');
|
598
|
+
};
|
599
|
+
|
600
|
+
process.cwd = function () { return '/' };
|
601
|
+
process.chdir = function (dir) {
|
602
|
+
throw new Error('process.chdir is not supported');
|
603
|
+
};
|
604
|
+
process.umask = function() { return 0; };
|
605
|
+
|
606
|
+
|
607
|
+
/***/ },
|
608
|
+
/* 6 */
|
609
|
+
/***/ function(module, exports, __webpack_require__) {
|
610
|
+
|
611
|
+
'use strict';
|
612
|
+
|
613
|
+
/*global ActiveXObject:true*/
|
614
|
+
|
615
|
+
var defaults = __webpack_require__(2);
|
616
|
+
var utils = __webpack_require__(3);
|
617
|
+
var buildUrl = __webpack_require__(7);
|
618
|
+
var parseHeaders = __webpack_require__(8);
|
619
|
+
var transformData = __webpack_require__(9);
|
620
|
+
|
621
|
+
module.exports = function xhrAdapter(resolve, reject, config) {
|
622
|
+
// Transform request data
|
623
|
+
var data = transformData(
|
624
|
+
config.data,
|
625
|
+
config.headers,
|
626
|
+
config.transformRequest
|
627
|
+
);
|
628
|
+
|
629
|
+
// Merge headers
|
630
|
+
var requestHeaders = utils.merge(
|
631
|
+
defaults.headers.common,
|
632
|
+
defaults.headers[config.method] || {},
|
633
|
+
config.headers || {}
|
634
|
+
);
|
635
|
+
|
636
|
+
if (utils.isFormData(data)) {
|
637
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
638
|
+
}
|
639
|
+
|
640
|
+
// Create the request
|
641
|
+
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP');
|
642
|
+
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true);
|
643
|
+
|
644
|
+
// Set the request timeout in MS
|
645
|
+
request.timeout = config.timeout;
|
646
|
+
|
647
|
+
// Listen for ready state
|
648
|
+
request.onreadystatechange = function () {
|
649
|
+
if (request && request.readyState === 4) {
|
650
|
+
// Prepare the response
|
651
|
+
var responseHeaders = parseHeaders(request.getAllResponseHeaders());
|
652
|
+
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;
|
653
|
+
var response = {
|
654
|
+
data: transformData(
|
655
|
+
responseData,
|
656
|
+
responseHeaders,
|
657
|
+
config.transformResponse
|
658
|
+
),
|
659
|
+
status: request.status,
|
660
|
+
statusText: request.statusText,
|
661
|
+
headers: responseHeaders,
|
662
|
+
config: config
|
663
|
+
};
|
664
|
+
|
665
|
+
// Resolve or reject the Promise based on the status
|
666
|
+
(request.status >= 200 && request.status < 300 ?
|
667
|
+
resolve :
|
668
|
+
reject)(response);
|
669
|
+
|
670
|
+
// Clean up request
|
671
|
+
request = null;
|
672
|
+
}
|
673
|
+
};
|
674
|
+
|
675
|
+
// Add xsrf header
|
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
|
+
}
|
690
|
+
}
|
691
|
+
|
692
|
+
// Add headers to the request
|
693
|
+
utils.forEach(requestHeaders, function (val, key) {
|
694
|
+
// Remove Content-Type if data is undefined
|
695
|
+
if (!data && key.toLowerCase() === 'content-type') {
|
696
|
+
delete requestHeaders[key];
|
697
|
+
}
|
698
|
+
// Otherwise add header to the request
|
699
|
+
else {
|
700
|
+
request.setRequestHeader(key, val);
|
701
|
+
}
|
702
|
+
});
|
703
|
+
|
704
|
+
// Add withCredentials to request if needed
|
705
|
+
if (config.withCredentials) {
|
706
|
+
request.withCredentials = true;
|
707
|
+
}
|
708
|
+
|
709
|
+
// Add responseType to request if needed
|
710
|
+
if (config.responseType) {
|
711
|
+
try {
|
712
|
+
request.responseType = config.responseType;
|
713
|
+
} catch (e) {
|
714
|
+
if (request.responseType !== 'json') {
|
715
|
+
throw e;
|
716
|
+
}
|
717
|
+
}
|
718
|
+
}
|
719
|
+
|
720
|
+
if (utils.isArrayBuffer(data)) {
|
721
|
+
data = new DataView(data);
|
722
|
+
}
|
723
|
+
|
724
|
+
// Send the request
|
725
|
+
request.send(data);
|
726
|
+
};
|
727
|
+
|
728
|
+
|
729
|
+
/***/ },
|
730
|
+
/* 7 */
|
731
|
+
/***/ function(module, exports, __webpack_require__) {
|
732
|
+
|
733
|
+
'use strict';
|
734
|
+
|
735
|
+
var utils = __webpack_require__(3);
|
736
|
+
|
737
|
+
function encode(val) {
|
738
|
+
return encodeURIComponent(val).
|
739
|
+
replace(/%40/gi, '@').
|
740
|
+
replace(/%3A/gi, ':').
|
741
|
+
replace(/%24/g, '$').
|
742
|
+
replace(/%2C/gi, ',').
|
743
|
+
replace(/%20/g, '+').
|
744
|
+
replace(/%5B/gi, '[').
|
745
|
+
replace(/%5D/gi, ']');
|
746
|
+
}
|
747
|
+
|
748
|
+
/**
|
749
|
+
* Build a URL by appending params to the end
|
750
|
+
*
|
751
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
752
|
+
* @param {object} [params] The params to be appended
|
753
|
+
* @returns {string} The formatted url
|
754
|
+
*/
|
755
|
+
module.exports = function buildUrl(url, params) {
|
756
|
+
if (!params) {
|
757
|
+
return url;
|
758
|
+
}
|
759
|
+
|
760
|
+
var parts = [];
|
761
|
+
|
762
|
+
utils.forEach(params, function (val, key) {
|
763
|
+
if (val === null || typeof val === 'undefined') {
|
764
|
+
return;
|
765
|
+
}
|
766
|
+
|
767
|
+
if (utils.isArray(val)) {
|
768
|
+
key = key + '[]';
|
769
|
+
}
|
770
|
+
|
771
|
+
if (!utils.isArray(val)) {
|
772
|
+
val = [val];
|
773
|
+
}
|
774
|
+
|
775
|
+
utils.forEach(val, function (v) {
|
776
|
+
if (utils.isDate(v)) {
|
777
|
+
v = v.toISOString();
|
778
|
+
}
|
779
|
+
else if (utils.isObject(v)) {
|
780
|
+
v = JSON.stringify(v);
|
781
|
+
}
|
782
|
+
parts.push(encode(key) + '=' + encode(v));
|
783
|
+
});
|
784
|
+
});
|
785
|
+
|
786
|
+
if (parts.length > 0) {
|
787
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
|
788
|
+
}
|
789
|
+
|
790
|
+
return url;
|
791
|
+
};
|
792
|
+
|
793
|
+
|
794
|
+
/***/ },
|
795
|
+
/* 8 */
|
796
|
+
/***/ function(module, exports, __webpack_require__) {
|
797
|
+
|
798
|
+
'use strict';
|
799
|
+
|
800
|
+
var utils = __webpack_require__(3);
|
801
|
+
|
802
|
+
/**
|
803
|
+
* Parse headers into an object
|
804
|
+
*
|
805
|
+
* ```
|
806
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
807
|
+
* Content-Type: application/json
|
808
|
+
* Connection: keep-alive
|
809
|
+
* Transfer-Encoding: chunked
|
810
|
+
* ```
|
811
|
+
*
|
812
|
+
* @param {String} headers Headers needing to be parsed
|
813
|
+
* @returns {Object} Headers parsed into an object
|
814
|
+
*/
|
815
|
+
module.exports = function parseHeaders(headers) {
|
816
|
+
var parsed = {}, key, val, i;
|
817
|
+
|
818
|
+
if (!headers) { return parsed; }
|
819
|
+
|
820
|
+
utils.forEach(headers.split('\n'), function(line) {
|
821
|
+
i = line.indexOf(':');
|
822
|
+
key = utils.trim(line.substr(0, i)).toLowerCase();
|
823
|
+
val = utils.trim(line.substr(i + 1));
|
824
|
+
|
825
|
+
if (key) {
|
826
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
827
|
+
}
|
828
|
+
});
|
829
|
+
|
830
|
+
return parsed;
|
831
|
+
};
|
832
|
+
|
833
|
+
|
834
|
+
/***/ },
|
835
|
+
/* 9 */
|
836
|
+
/***/ function(module, exports, __webpack_require__) {
|
837
|
+
|
838
|
+
'use strict';
|
839
|
+
|
840
|
+
var utils = __webpack_require__(3);
|
841
|
+
|
842
|
+
/**
|
843
|
+
* Transform the data for a request or a response
|
844
|
+
*
|
845
|
+
* @param {Object|String} data The data to be transformed
|
846
|
+
* @param {Array} headers The headers for the request or response
|
847
|
+
* @param {Array|Function} fns A single function or Array of functions
|
848
|
+
* @returns {*} The resulting transformed data
|
849
|
+
*/
|
850
|
+
module.exports = function transformData(data, headers, fns) {
|
851
|
+
utils.forEach(fns, function (fn) {
|
852
|
+
data = fn(data, headers);
|
853
|
+
});
|
854
|
+
|
855
|
+
return data;
|
856
|
+
};
|
857
|
+
|
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
|
+
|
908
|
+
/***/ },
|
909
|
+
/* 11 */
|
910
|
+
/***/ function(module, exports, __webpack_require__) {
|
911
|
+
|
912
|
+
'use strict';
|
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
|
+
|
920
|
+
var utils = __webpack_require__(3);
|
921
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
922
|
+
var urlParsingNode = document.createElement('a');
|
923
|
+
var originUrl;
|
924
|
+
|
925
|
+
/**
|
926
|
+
* Parse a URL to discover it's components
|
927
|
+
*
|
928
|
+
* @param {String} url The URL to be parsed
|
929
|
+
* @returns {Object}
|
930
|
+
*/
|
931
|
+
function urlResolve(url) {
|
932
|
+
var href = url;
|
933
|
+
|
934
|
+
if (msie) {
|
935
|
+
// IE needs attribute set twice to normalize properties
|
936
|
+
urlParsingNode.setAttribute('href', href);
|
937
|
+
href = urlParsingNode.href;
|
938
|
+
}
|
939
|
+
|
940
|
+
urlParsingNode.setAttribute('href', href);
|
941
|
+
|
942
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
943
|
+
return {
|
944
|
+
href: urlParsingNode.href,
|
945
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
946
|
+
host: urlParsingNode.host,
|
947
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
948
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
949
|
+
hostname: urlParsingNode.hostname,
|
950
|
+
port: urlParsingNode.port,
|
951
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
952
|
+
urlParsingNode.pathname :
|
953
|
+
'/' + urlParsingNode.pathname
|
954
|
+
};
|
955
|
+
}
|
956
|
+
|
957
|
+
originUrl = urlResolve(window.location.href);
|
958
|
+
|
959
|
+
/**
|
960
|
+
* Determine if a URL shares the same origin as the current location
|
961
|
+
*
|
962
|
+
* @param {String} requestUrl The URL to test
|
963
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
964
|
+
*/
|
965
|
+
module.exports = function urlIsSameOrigin(requestUrl) {
|
966
|
+
var parsed = (utils.isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
|
967
|
+
return (parsed.protocol === originUrl.protocol &&
|
968
|
+
parsed.host === originUrl.host);
|
969
|
+
};
|
970
|
+
|
971
|
+
|
972
|
+
/***/ },
|
973
|
+
/* 12 */
|
974
|
+
/***/ function(module, exports, __webpack_require__) {
|
975
|
+
|
976
|
+
'use strict';
|
977
|
+
|
978
|
+
var utils = __webpack_require__(3);
|
979
|
+
|
980
|
+
function InterceptorManager() {
|
981
|
+
this.handlers = [];
|
982
|
+
}
|
983
|
+
|
984
|
+
/**
|
985
|
+
* Add a new interceptor to the stack
|
986
|
+
*
|
987
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
988
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
989
|
+
*
|
990
|
+
* @return {Number} An ID used to remove interceptor later
|
991
|
+
*/
|
992
|
+
InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
993
|
+
this.handlers.push({
|
994
|
+
fulfilled: fulfilled,
|
995
|
+
rejected: rejected
|
996
|
+
});
|
997
|
+
return this.handlers.length - 1;
|
998
|
+
};
|
999
|
+
|
1000
|
+
/**
|
1001
|
+
* Remove an interceptor from the stack
|
1002
|
+
*
|
1003
|
+
* @param {Number} id The ID that was returned by `use`
|
1004
|
+
*/
|
1005
|
+
InterceptorManager.prototype.eject = function (id) {
|
1006
|
+
if (this.handlers[id]) {
|
1007
|
+
this.handlers[id] = null;
|
1008
|
+
}
|
1009
|
+
};
|
1010
|
+
|
1011
|
+
/**
|
1012
|
+
* Iterate over all the registered interceptors
|
1013
|
+
*
|
1014
|
+
* This method is particularly useful for skipping over any
|
1015
|
+
* interceptors that may have become `null` calling `remove`.
|
1016
|
+
*
|
1017
|
+
* @param {Function} fn The function to call for each interceptor
|
1018
|
+
*/
|
1019
|
+
InterceptorManager.prototype.forEach = function (fn) {
|
1020
|
+
utils.forEach(this.handlers, function (h) {
|
1021
|
+
if (h !== null) {
|
1022
|
+
fn(h);
|
1023
|
+
}
|
1024
|
+
});
|
1025
|
+
};
|
1026
|
+
|
1027
|
+
module.exports = InterceptorManager;
|
1028
|
+
|
1029
|
+
|
1030
|
+
/***/ },
|
1031
|
+
/* 13 */
|
1032
|
+
/***/ function(module, exports) {
|
1033
|
+
|
1034
|
+
'use strict';
|
1035
|
+
|
1036
|
+
/**
|
1037
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
1038
|
+
*
|
1039
|
+
* Common use case would be to use `Function.prototype.apply`.
|
1040
|
+
*
|
1041
|
+
* ```js
|
1042
|
+
* function f(x, y, z) {}
|
1043
|
+
* var args = [1, 2, 3];
|
1044
|
+
* f.apply(null, args);
|
1045
|
+
* ```
|
1046
|
+
*
|
1047
|
+
* With `spread` this example can be re-written.
|
1048
|
+
*
|
1049
|
+
* ```js
|
1050
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
1051
|
+
* ```
|
1052
|
+
*
|
1053
|
+
* @param {Function} callback
|
1054
|
+
* @returns {Function}
|
1055
|
+
*/
|
1056
|
+
module.exports = function spread(callback) {
|
1057
|
+
return function (arr) {
|
1058
|
+
return callback.apply(null, arr);
|
1059
|
+
};
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
|
1063
|
+
/***/ }
|
1064
|
+
/******/ ])
|
1065
|
+
});
|
1066
|
+
;
|
1067
|
+
//# sourceMappingURL=axios.map
|
@@ -0,0 +1,3 @@
|
|
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
|
+
//# sourceMappingURL=axios.min.map
|
data/axios_rails.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'axios_rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "axios_rails"
|
8
|
+
spec.version = AxiosRails::VERSION
|
9
|
+
spec.authors = ["Katherine Adam"]
|
10
|
+
spec.email = ["muedasnka@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Integrates Axios into your Rails app.}
|
13
|
+
spec.description = %q{Adds Axios into your Rails app.}
|
14
|
+
spec.homepage = "https://github.com/KatherineMuedas/axios_rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "axios_rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/axios_rails.rb
ADDED
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: axios_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Katherine Adam
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Adds Axios into your Rails app.
|
42
|
+
email:
|
43
|
+
- muedasnka@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- CODE_OF_CONDUCT.md
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- app/assets/javascripts/axios.js
|
56
|
+
- app/assets/javascripts/axios.min.js
|
57
|
+
- axios_rails.gemspec
|
58
|
+
- bin/console
|
59
|
+
- bin/setup
|
60
|
+
- lib/axios_rails.rb
|
61
|
+
- lib/axios_rails/engine.rb
|
62
|
+
- lib/axios_rails/version.rb
|
63
|
+
homepage: https://github.com/KatherineMuedas/axios_rails
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.5.0
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Integrates Axios into your Rails app.
|
87
|
+
test_files: []
|