-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add Simplified multipart/form-data Support to Web Cmdlets Through -Form Parameter #5972
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
Changes from all commits
d383458
2abd895
cb249f0
3939df9
c45e693
3bcf3af
a64dfeb
aa187ff
b4ac5c4
ca81f0a
9e78323
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,6 +138,12 @@ | |
| <data name="BodyConflict" xml:space="preserve"> | ||
| <value>The cmdlet cannot run because the following conflicting parameters are specified: Body and InFile. Specify either Body or Infile, then retry. </value> | ||
| </data> | ||
| <data name="BodyFormConflict" xml:space="preserve"> | ||
| <value>The cmdlet cannot run because the following conflicting parameters are specified: Body and Form. Specify either Body or Form, then retry. </value> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see we use the file pattern but the messages can be shorter - "Conflicting parameters are specified: Body and Form." Maybe fix this in the PR or new one?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an existing issue #5140 can you comment there?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| </data> | ||
| <data name="FormInFileConflict" xml:space="preserve"> | ||
| <value>The cmdlet cannot run because the following conflicting parameters are specified: InFile and Form. Specify either InFile or Form, then retry. </value> | ||
| </data> | ||
| <data name="CredentialConflict" xml:space="preserve"> | ||
| <value>The cmdlet cannot run because the following conflicting parameters are specified: Credential and UseDefaultCredentials. Specify either Credential or UseDefaultCredentials, then retry.</value> | ||
| </data> | ||
|
|
||
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.
Dbg.Assert() instead?
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.
The pattern is common in the file.
Uh oh!
There was an error while loading. Please reload this page.
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.
FYI, this type of null check (null on the LHS) is a C++ idiom that is unnecessary in C# because if/while/do conditions in C# must evaluate to a Boolean. Therefore a mistaken assignment e.g.
if (formData = null)would fail to compile because the type of formData can't be a Boolean (not if you're assigning null to it). In fact, the only time you need to put the literal on the LHS is when the variable type is a Boolean e.g.if (false == aBooleanVariable).My team's internal coding guidelines suggest not using
==or!=in the Boolean variable case but useif (!aBooleanVariable)orif (aBooleanVariable)instead. Consequently, we never put the literal value on the LHS in C# code. And IMO this approach reads easier e.g.if (formData == null).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.
@rkeithhill The problem is more that this file uses inconsistent forms and I forget which one is being used in which context. In some parts of the file null is left in others null is right. As long as there isn't some programmatic consideration (I suspected there wasn't), I don't have an opinion either way.
null == fooandfoo == nullread exactly the same to me with out one being easier than the other. I have a habit of "literals go left" because it is a common pattern in many languages for various reasons.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.
@SteveL-MSFT I'm not entire certain of the future of these new methods. I get the feeling they may end up moving to a helper class as static methods to be consumed in more places. throw seems more portable, IMO.
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 like
(formData == null)too.But here we should use the file pattern.
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.
@markekraus since the pattern already exists in this file, I'm fine keeping it for now. Consider this closed for me.