From 1107cc625e4cc469276483316c48896a21f6251a Mon Sep 17 00:00:00 2001 From: deadNightTiger Date: Sat, 28 Nov 2020 03:21:23 +0400 Subject: [PATCH] Add a test for `promise.json()` (#1541) --- test/promise.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/promise.ts b/test/promise.ts index da3e3783e..e797735be 100644 --- a/test/promise.ts +++ b/test/promise.ts @@ -79,3 +79,13 @@ test('promise.json() can be called before a file stream body is open', withServe await Promise.all(checks); }); + +test.failing('promise.json() does not fail when server returns an error', withServer, async (t, server, got) => { + server.get('/', (_request, response) => { + response.statusCode = 400; + response.end('{}'); + }); + + const promise = got('', {throwHttpErrors: false}); + await t.notThrowsAsync(promise.json()); +});