We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Methods generated with the client generated by angular2-typescript do not handle file uploads properly.
Live editor.swagger.io version. I don't know which one they use.
Any method declared with a file is affected.
/upload_doc: post: consumes: - multipart/form-data parameters: - name: file type: file in: formData required: true responses: 200: description: OK
Generates something like :
headers.set('Content-Type', 'application/x-www-form-urlencoded'); if (file !== undefined) { formParams.set('file', <any>file); } let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Post, headers: headers, body: formParams.toString(), <----- is this correct ? search: queryParameters, withCredentials:this.configuration.withCredentials });
The Following typescript code seems to works fine to post a file to a server.
const formData: FormData = new FormData(); formData.append('file', file, file.name); this.http.post(target, formData, options);
P.S. I'm new with angular, i might be making some mistakes calling the method which i am not aware of.
The text was updated successfully, but these errors were encountered:
Please try the latest master (2.3.0), which has a lot of enhancements. SNAPSHOT version of 2.3.0 JAR can be found in the project's README.
Sorry, something went wrong.
@itsTeknas @wing328 this was fixed with #6574 (#6457)
No branches or pull requests
Description
Methods generated with the client generated by angular2-typescript do not handle file uploads properly.
Swagger-codegen version
Live editor.swagger.io version. I don't know which one they use.
Swagger declaration file content or url
Any method declared with a file is affected.
Generates something like :
Suggest a fix/enhancement
The Following typescript code seems to works fine to post a file to a server.
P.S. I'm new with angular, i might be making some mistakes calling the method which i am not aware of.
The text was updated successfully, but these errors were encountered: