mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Fix unix domain socket match
This commit is contained in:
parent
de610f419b
commit
61fab44b04
@ -367,4 +367,38 @@ describe('actuallySend()', () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('uses works with "unix" host', async () => {
|
||||
const workspace = await models.workspace.create();
|
||||
const settings = await models.settings.create();
|
||||
|
||||
const request = Object.assign(models.request.init(), {
|
||||
_id: 'req_123',
|
||||
parentId: workspace._id,
|
||||
url: 'http://unix:3000/my/path',
|
||||
method: 'GET'
|
||||
});
|
||||
|
||||
const renderedRequest = await getRenderedRequest(request);
|
||||
const {bodyBuffer} = await networkUtils._actuallySend(renderedRequest, workspace, settings);
|
||||
// console.log('HELLO', response);
|
||||
|
||||
const body = JSON.parse(bodyBuffer);
|
||||
expect(body).toEqual({
|
||||
options: {
|
||||
CUSTOMREQUEST: 'GET',
|
||||
ACCEPT_ENCODING: '',
|
||||
COOKIEFILE: '',
|
||||
FOLLOWLOCATION: true,
|
||||
HTTPHEADER: ['content-type: '],
|
||||
NOPROGRESS: false,
|
||||
PROXY: '',
|
||||
NOBODY: 0,
|
||||
TIMEOUT_MS: 0,
|
||||
URL: 'http://unix:3000/my/path',
|
||||
USERAGENT: `insomnia/${getAppVersion()}`,
|
||||
VERBOSE: true
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -162,7 +162,7 @@ export function _actuallySend (renderedRequest, workspace, settings) {
|
||||
// Set the URL, including the query parameters
|
||||
const qs = querystring.buildFromParams(renderedRequest.parameters);
|
||||
const url = querystring.joinUrl(renderedRequest.url, qs);
|
||||
const isUnixSocket = url.match(/https?:\/\/unix:/);
|
||||
const isUnixSocket = url.match(/https?:\/\/unix:\//);
|
||||
const finalUrl = util.prepareUrlForSending(url, renderedRequest.settingEncodeUrl);
|
||||
if (isUnixSocket) {
|
||||
// URL prep will convert "unix:/path" hostname to "unix/path"
|
||||
|
Loading…
Reference in New Issue
Block a user