-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Typescript+Axios: multipart/form-data correctly handled #2002
Typescript+Axios: multipart/form-data correctly handled #2002
Conversation
@@ -24,7 +24,7 @@ | |||
}, | |||
"devDependencies": { | |||
"@types/node": "^8.0.9", | |||
"typescript": "^2.4" | |||
"typescript": "^3.2" |
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.
which feature requires typescript 3.2? I would widen the restriction as much as possible
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.
Reverted at 9818ee8 -
Thought the spread operators was a later language feature
: configuration.accessToken; | ||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function' | ||
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) | ||
: configuration.accessToken; | ||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; | ||
} | ||
|
||
if (tags) { | ||
localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); |
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.
should be adapted too, for consistency
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.
Addressed in 3ba25dc
public Map<String, Object> postProcessOperations(Map<String, Object> objs) { | ||
objs = super.postProcessOperations(objs); | ||
Map<String, Object> vals = (Map<String, Object>)objs.get("operations"); | ||
List<CodegenOperation> operations = (List<CodegenOperation>)vals.get("operation"); |
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.
add comment what this does
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.
Addressed in 3ba25dc
On an unrelated note - seems like the Shippable pipeline is broken due to debian packages being missing. |
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.
LGTM, haven't tested it
@mvniekerk the build failed with the following errors:
Please take a look and let us know if you need help fixing the issue. |
Update: Pushed 061cea5 to fix the compilation error. Let's see how it goes. |
All CI tests passed 👍 |
…#2002) * Typescript 3.2 * Typescript spread operator * Add vendor extension to the operation * Remove url.URLSearchParams * Generate form data in API * Make axios scripts executable * Reran generator * Generate sample code * Revert to 2.4 Typescript * COLLECTION_FORMAT.{{collectionFormat}} everywhere for consistency * Consistency on the CollectionFormats, comment on the vendor extension * fix compilation error
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,. Default:3.4.x
,4.0.x
master
.@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10)
Description of the PR
When doing a multipart/formdata request, the current state is that it changes the content type to ''application/x-www-form-urlencoded" (violating the contract) and then does a toString() on the request data.
What this PR does is to use FormData as the data, it appends (instead of doing a .set()) and then omits the toString() when the content-type is multipart/form-data