mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
feat(dns): added support for a custom lookup function; (#5339)
This commit is contained in:
@@ -627,3 +627,17 @@ for (const [header, value] of headers) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// lookup
|
||||
axios.get('/user', {
|
||||
lookup: (hostname: string, opt: object, cb: (err: Error | null, address: string, family: number) => void) => {
|
||||
cb(null, '127.0.0.1', 4);
|
||||
}
|
||||
});
|
||||
|
||||
// lookup async
|
||||
axios.get('/user', {
|
||||
lookup: (hostname: string, opt: object) => {
|
||||
return ['127.0.0.1', 4];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user