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

File Upload: Allow to set values like contentType in RequestBuilder.body or options.reportProgress in RequestBuilder.build #259

Open
ophirKatz opened this issue Jan 25, 2023 · 1 comment
Labels
needs info More information is needed

Comments

@ophirKatz
Copy link

Hi! I'm trying to implement file upload in my application, using the Blob type.
Specifically, I have a request body object that contains some normal fields and one File field:

interface FileUploadRequest {
  name: string;
  file: File;
}

I want to use the generated http service in order to send this request, but I need to use FormData to send the file.
The RequestBuilder supports Blob types and can create a FormData object with all fields, but only via the rb.body method. But, the service does not expose a parameter to override the body's content type (which controls whether FormData is used or not - 'multipart/form-data'), and the default is 'application/json'.
Moreover, I'd like to override the value for reportProgress in the options object passed to rb.build, but again - not possible.

Any ideas is this is possible? Or how it can be done using the generated code?

Thank you!

@ophirKatz ophirKatz changed the title Allow to set values like contentType in RequestBuilder.body or options.reportProgress in RequestBuilder.build FileUpload: Allow to set values like contentType in RequestBuilder.body or options.reportProgress in RequestBuilder.build Jan 25, 2023
@ophirKatz ophirKatz changed the title FileUpload: Allow to set values like contentType in RequestBuilder.body or options.reportProgress in RequestBuilder.build File Upload: Allow to set values like contentType in RequestBuilder.body or options.reportProgress in RequestBuilder.build Jan 25, 2023
@luisfpg
Copy link
Contributor

luisfpg commented Feb 2, 2023

Can you post the OpenAPI descriptor for the operation?
Seems like you're not mapping the content type in the requestBody element

@luisfpg luisfpg added the needs info More information is needed label Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info More information is needed
Projects
None yet
Development

No branches or pull requests

2 participants