Skip to content

Commit 8862270

Browse files
committedMay 10, 2020
Fix reusing options when paginating
Fixes #1223
1 parent 7d7361c commit 8862270

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎source/create.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ const create = (defaults: InstanceDefaults): Got => {
239239
return;
240240
}
241241

242-
if (optionsToMerge !== undefined) {
242+
if (optionsToMerge === result.request.options) {
243+
normalizedOptions = result.request.options;
244+
} else if (optionsToMerge !== undefined) {
243245
normalizedOptions = normalizeArguments(undefined, optionsToMerge, normalizedOptions);
244246
}
245247

‎test/pagination.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ test('allowGetBody sends json payload with .paginate()', withBodyParsingServer,
333333
t.deepEqual(results, [1, 2, 3]);
334334
});
335335

336-
test.failing('`hooks` are not duplicated', withBodyParsingServer, async (t, server, got) => {
336+
test('`hooks` are not duplicated', withBodyParsingServer, async (t, server, got) => {
337337
let page = 1;
338338
server.get('/', (_request, response) => {
339339
response.end(JSON.stringify([page++]));

0 commit comments

Comments
 (0)
Please sign in to comment.