mirror of
https://github.com/tenrok/axios.git
synced 2026-05-21 13:24:11 +03:00
add test case
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<form role="form" class="form" onsubmit="return false;">
|
||||
<div class="form-group">
|
||||
<label for="data">JSON</label>
|
||||
<textarea id="data" class="form-control" rows="5">"data"</textarea>
|
||||
<textarea id="data" class="form-control" rows="5"></textarea>
|
||||
</div>
|
||||
<button id="post" type="button" class="btn btn-primary">POST</button>
|
||||
</form>
|
||||
@@ -24,9 +24,7 @@
|
||||
document.getElementById('post').onclick = function () {
|
||||
var data = document.getElementById('data').value;
|
||||
|
||||
axios.post('/post/server', data,{
|
||||
xDomain : true
|
||||
},JSON.parse(data))
|
||||
axios.post('/post/server', JSON.parse(data))
|
||||
.then(function (res) {
|
||||
output.className = 'container';
|
||||
output.innerHTML = res.data;
|
||||
|
||||
@@ -76,7 +76,6 @@ dirs = listDirs(__dirname);
|
||||
|
||||
server = http.createServer(function (req, res) {
|
||||
var url = req.url;
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
// Process axios itself
|
||||
if (/axios\.min\.js$/.test(url)) {
|
||||
|
||||
@@ -5,8 +5,6 @@ var utils = require('./utils');
|
||||
var dispatchRequest = require('./core/dispatchRequest');
|
||||
var InterceptorManager = require('./core/InterceptorManager');
|
||||
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
function Axios (defaultConfig) {
|
||||
this.defaultConfig = utils.merge({
|
||||
headers: {},
|
||||
|
||||
@@ -59,7 +59,8 @@ describe('requests', function () {
|
||||
|
||||
axios({
|
||||
method: 'post',
|
||||
url: 'www.someurl.com/foo'
|
||||
url: 'www.someurl.com/foo',
|
||||
xDomain: true
|
||||
}).then(function(res){
|
||||
response = res;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user