sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why I keep getting HTTPError when the throwHttpErrors is already set to `false`

nekochan0122 opened this issue · comments

We have a test that shows it should be working, but I'm happy to look further into it if you submit a failing test.

ky/test/main.ts

Lines 407 to 416 in ec6733c

test('throwHttpErrors option', async t => {
const server = await createHttpTestServer();
server.get('/', (_request, response) => {
response.sendStatus(500);
});
await t.notThrowsAsync(ky.get(server.url, {throwHttpErrors: false}).text());
await server.close();
});

We have a test that shows it should be working, but I'm happy to look further into it if you submit a failing test.

ky/test/main.ts

Lines 407 to 416 in ec6733c

test('throwHttpErrors option', async t => {
const server = await createHttpTestServer();
server.get('/', (_request, response) => {
response.sendStatus(500);
});
await t.notThrowsAsync(ky.get(server.url, {throwHttpErrors: false}).text());
await server.close();
});

Sorry, the throwHttpErrors option is working, the Error was throw by other request.