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

multipart/form-data with axios client generates incorrect headers #1625

Closed
mala-rathinasamy-kmart opened this issue Jan 24, 2025 · 2 comments
Labels
bug 🔥 Something isn't working

Comments

@mala-rathinasamy-kmart
Copy link

mala-rathinasamy-kmart commented Jan 24, 2025

Description

Description
Generated sdk.gen.ts for a POST endpoint that consumes multipart/form-data contains incorrect headers - .options?.headers

 headers: {
            'Content-Type': null,
            ...options?.headers
        },

Reproducible example
open api spec file is here - https://stackblitz.com/edit/hey-api-client-fetch-example-kq8hhstb?file=src%2Fopenapi%2Fmy-spec.json
config file is here - https://stackblitz.com/edit/hey-api-client-fetch-example-kq8hhstb?file=openapi-ts.config.ts

generated files are here -
https://stackblitz.com/edit/hey-api-client-fetch-example-kq8hhstb?file=src%2Fclient%2Fsdk.gen.ts

the generated sdk.gen.ts- gives typescript error

Image

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example-kq8hhstb?file=src%2Fclient%2Fsdk.gen.ts

OpenAPI specification (optional)

{
  "swagger": "2.0",
  "info": {
    "version": "v023",
    "title": "CustomerIT STR API",
    "description": "The CustomerIT Store Service HTTPS API",
    "termsOfService": "Terms Of Service"
  },
  "paths": {

    "/api/Logging/UploadLogFile": {
      "post": {
        "tags": ["Logging"],
        "summary": "Upload log file to the store server",
        "operationId": "UploadLogFile",
        "consumes": ["multipart/form-data"],
        "produces": [],
        "parameters": [
          {
            "name": "file",
            "in": "formData",
            "required": false,
            "type": "file"
          }
        ],
        "responses": {
          "200": {
            "description": "Upload is successful.",
            "schema": {
              "$ref": "#/definitions/IActionResult"
            }
          },
          "500": {
            "description": "Unhandled exception has occured. It will return an array of strings with the error messages."
          }
        }
      }
    }

  },
  "definitions": {

    "IActionResult": {
      "type": "object",
      "properties": {}
    }
  }

}


### System information (optional)

_No response_
@mala-rathinasamy-kmart mala-rathinasamy-kmart added the bug 🔥 Something isn't working label Jan 24, 2025
Copy link

stackblitz bot commented Jan 24, 2025

@mala-rathinasamy-kmart
Copy link
Author

this seems to be fixed by upgrading to
"@hey-api/openapi-ts": "^0.62.3",
"@hey-api/client-axios": "^0.5.1",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant