Skip to content

Commit

Permalink
test: add failing test for handling errors in a custom DNS lookup fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
michal-billtech committed Dec 11, 2023
1 parent b3be365 commit 18ad8b0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unit/adapters/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -2216,5 +2216,19 @@ describe('supports http with nodejs', function () {

assert.strictEqual(data, payload);
});

it('should handle errors in a custom DNS lookup function', async function () {
server = await startHTTPServer(SERVER_HANDLER_STREAM_ECHO);

const payload = 'test';

const error = new Error('test');

await assert.rejects(() => axios.post(`https://fake-name.axios:4444`, payload,{
lookup: async (hostname, opt) => {
throw error;
}
}), error);
});
});
});

0 comments on commit 18ad8b0

Please sign in to comment.