forked from axios/axios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(http): fixed support for IPv6 literal strings in url (axios#5731)
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,44 @@ describe('supports http with nodejs', function () { | |
delete process.env.no_proxy; | ||
}); | ||
|
||
it('should support IPv4 literal strings', function (done) { | ||
|
||
var data = { | ||
firstName: 'Fred', | ||
lastName: 'Flintstone', | ||
emailAddr: '[email protected]' | ||
}; | ||
|
||
server = http.createServer(function (req, res) { | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.end(JSON.stringify(data)); | ||
}).listen(4444, function () { | ||
axios.get('http://127.0.0.1:4444/').then(function (res) { | ||
assert.deepEqual(res.data, data); | ||
done(); | ||
}).catch(done); | ||
}); | ||
}); | ||
|
||
it('should support IPv6 literal strings', function (done) { | ||
|
||
var data = { | ||
firstName: 'Fred', | ||
lastName: 'Flintstone', | ||
emailAddr: '[email protected]' | ||
}; | ||
|
||
server = http.createServer(function (req, res) { | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.end(JSON.stringify(data)); | ||
}).listen(4444, function () { | ||
axios.get('http://[::1]:4444/').then(function (res) { | ||
assert.deepEqual(res.data, data); | ||
done(); | ||
}).catch(done); | ||
}); | ||
}); | ||
|
||
it('should throw an error if the timeout property is not parsable as a number', function (done) { | ||
|
||
server = http.createServer(function (req, res) { | ||
|