mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Merge pull request #1366 from emilyemorehouse/fix/1070
Follow up to #1070 - adding documentation and tests
This commit is contained in:
@@ -315,6 +315,8 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
|
|
||||||
// `socketPath` defines a UNIX Socket to be used in node.js.
|
// `socketPath` defines a UNIX Socket to be used in node.js.
|
||||||
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
|
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
|
||||||
|
// Only either `socketPath` or `proxy` can be specified.
|
||||||
|
// If both are specified, `socketPath` is used.
|
||||||
socketPath: null, // default
|
socketPath: null, // default
|
||||||
|
|
||||||
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
var axios = require('../../../index');
|
var axios = require('../../../index');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
|
var net = require('net');
|
||||||
var url = require('url');
|
var url = require('url');
|
||||||
var zlib = require('zlib');
|
var zlib = require('zlib');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
@@ -228,6 +229,24 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testSocket: function (test) {
|
||||||
|
server = net.createServer(function (socket) {
|
||||||
|
socket.on('data', function() {
|
||||||
|
socket.end('HTTP/1.1 200 OK\r\n\r\n');
|
||||||
|
});
|
||||||
|
}).listen('./test.sock', function() {
|
||||||
|
axios({
|
||||||
|
socketPath: './test.sock',
|
||||||
|
url: '/'
|
||||||
|
})
|
||||||
|
.then(function(resp) {
|
||||||
|
test.equal(resp.status, 200);
|
||||||
|
test.equal(resp.statusText, 'OK');
|
||||||
|
test.done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
testStream: function(test) {
|
testStream: function(test) {
|
||||||
server = http.createServer(function (req, res) {
|
server = http.createServer(function (req, res) {
|
||||||
req.pipe(res);
|
req.pipe(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user