From 8be47723a44b31baa4afef68246d2183af83ddd4 Mon Sep 17 00:00:00 2001 From: Szymon Marczak <36894700+szmarczak@users.noreply.github.com> Date: Tue, 13 Apr 2021 22:20:28 +0200 Subject: [PATCH] Make sure it merges instances in order, omits Got defaults Fixes #1450 --- test/normalize-arguments.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/normalize-arguments.ts b/test/normalize-arguments.ts index a02802d72..7c0985dd1 100644 --- a/test/normalize-arguments.ts +++ b/test/normalize-arguments.ts @@ -133,3 +133,20 @@ test('maxRetryAfter is calculated seperately from request timeout', t => { t.is(options.retry.maxRetryAfter, 300); }); + +test('extending responseType', async t => { + const instance1 = got.extend({ + prefixUrl: 'https://localhost', + responseType: 'json' + }); + + const instance2 = got.extend({ + headers: { + 'x-test': 'test' + } + }); + + const merged = instance1.extend(instance2); + + t.is(merged.defaults.options.responseType, 'json'); +});