-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Conversation
Can you add a test? |
And it's inconsistent to uppercase these while others are lowercased: Lines 18 to 23 in 3fd590a
|
10e819c
to
4faa58e
Compare
source/index.js
Outdated
@@ -33,7 +33,6 @@ const defaults = { | |||
}, | |||
cache: false, | |||
decompress: true, | |||
useElectronNet: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's not needed. See https://github.com/sindresorhus/got/blob/master/source/request-as-event-emitter.js#L43
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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 :)
No description provided.