openapi-typescript-codegen icon indicating copy to clipboard operation
openapi-typescript-codegen copied to clipboard

Issue with Multipart Form Data Serialization in openapi-typescript-codegen

Open gpiedimonte opened this issue 2 years ago • 1 comments

I am encountering an issue when using the openapi-typescript-codegen library to invoke a REST web service written in .NET Core. The service works perfectly with PHP and other .NET clients, but the problem arises when trying to use React in TypeScript with the openapi-typescript-codegen library.

The service I'm attempting to invoke accepts multipart form data. However, there seems to be a critical bug during the serialization of the multipart component when using the code generated by openapi-typescript-codegen. image

Expected Behavior The generated code by openapi-typescript-codegen should produce a valid multipart form data request that is equivalent to a manually crafted request using Swagger.

Actual Behavior The generated request by openapi-typescript-codegen results in a 400 Bad Request response from the server. 'Failed to read the request form. Unexpected end of Stream, the content may have already been read by another component. '

This is the client code generated :

image

gpiedimonte avatar Sep 28 '23 09:09 gpiedimonte

Check out our fork of this repository @hey-api/openapi-ts. We have fixed this issue in v0.32.1. If you run into any further issues, open an issue in our repository. Thanks.

jordanshatford avatar Mar 30 '24 23:03 jordanshatford