Skip to content

Commit

Permalink
Make sure it merges instances in order, omits Got defaults
Browse files Browse the repository at this point in the history
Fixes #1450
  • Loading branch information
szmarczak committed Apr 13, 2021
1 parent 3f45e47 commit 8be4772
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/normalize-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

0 comments on commit 8be4772

Please sign in to comment.