Skip to content

Commit

Permalink
Revert "Revert init hooks not being called on empty options"
Browse files Browse the repository at this point in the history
This reverts commit a398e36.
  • Loading branch information
szmarczak committed Aug 4, 2021
1 parent 439fb82 commit be3462d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/core/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ export default class Options {
}
} else {
try {
this.merge(options ?? {});
this.merge(options);
} finally {
if (options?.url !== undefined) {
if (input === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion test/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ test('does not include the `request` option in normalized `http` options', withS
});

test('should pass an options object into an initialization hook after .extend', withServer, async (t, server, got) => {
t.plan(2);
t.plan(1);

server.get('/', echoHeaders);

Expand Down

1 comment on commit be3462d

@szmarczak
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some thoughts a398e36 made no sense. init is called when there's normalization. If there's no normalization, the default values should be set in a beforeRequest hook.

Please sign in to comment.