Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize options.method #547

Merged
merged 4 commits into from Aug 8, 2018

Conversation

szmarczak
Copy link
Collaborator

No description provided.

@sindresorhus
Copy link
Owner

Can you add a test?

@sindresorhus
Copy link
Owner

And it's inconsistent to uppercase these while others are lowercased:

got/source/index.js

Lines 18 to 23 in 3fd590a

'get',
'put',
'head',
'delete',
'options',
'trace'

source/index.js Outdated
@@ -33,7 +33,6 @@ const defaults = {
},
cache: false,
decompress: true,
useElectronNet: false,
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

I think it's still useful to declare all options up-front, even if they are false by default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I'll leave that then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -37,7 +37,8 @@ const create = defaults => {
return defaults.handler(normalizeArguments(url, options, defaults), next);
};

for (const method of defaults.methods) {
const methods = defaults.methods.map(method => method.toLowerCase());
Copy link
Owner

Choose a reason for hiding this comment

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

Why are you lowercasing them here, but uppercasing them in normalize-arguments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why are you lowercasing them here,

Imagine calling got.POST instead of got.post :P

but uppercasing them in normalize-arguments?

To keep things consistent; because error.method is uppercased :)

Copy link
Owner

Choose a reason for hiding this comment

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

Nvm. I missed the context. It's late here...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's ok, answering questions is my job :P It's a bit late here too :)

@sindresorhus sindresorhus merged commit ecf3180 into sindresorhus:master Aug 8, 2018
@szmarczak szmarczak deleted the normalize-method branch January 17, 2019 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants