Skip to content

Commit

Permalink
Fix reusing options when paginating
Browse files Browse the repository at this point in the history
Fixes #1223
  • Loading branch information
szmarczak committed May 10, 2020
1 parent 7d7361c commit 8862270
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion source/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ const create = (defaults: InstanceDefaults): Got => {
return;
}

if (optionsToMerge !== undefined) {
if (optionsToMerge === result.request.options) {
normalizedOptions = result.request.options;
} else if (optionsToMerge !== undefined) {
normalizedOptions = normalizeArguments(undefined, optionsToMerge, normalizedOptions);
}

Expand Down
2 changes: 1 addition & 1 deletion test/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ test('allowGetBody sends json payload with .paginate()', withBodyParsingServer,
t.deepEqual(results, [1, 2, 3]);
});

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

0 comments on commit 8862270

Please sign in to comment.