Skip to content

[BUG][Typescript Axios] Content-type not set #2694

@julaudo

Description

@julaudo
Description

Typescript axios generators does not handle correctly multipart requests. Content-Type header is never set.

openapi-generator version

4.0.0-beta3

OpenAPI declaration file content or url
openapi: 3.0.0

paths:
  'upload':
    post:
      summary: Upload File
      description: ''
      operationId: uploadFile
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/logoForCreation'
            encoding:
              medicalCertificateFileName:
                contentType: image/png, image/jpeg

        required:
          true
        description: body
      responses:
        201:
          description: Created or updated club's logo
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/photo'
components:
  schemas:
    logoForCreation:
      type: object
      required:
        - logoFileName
      properties:
        logoFileName:
          type: string
          format: binary
    photo:
      required:
        - location
      properties:
        location:
          type: string
Command line used for generation

openapi-generator generate -i swagger.yaml -g typescript-axios -o src/generated --skip-validate-spec

Steps to reproduce

Run the above command with the included yaml
Notice that the following expected line is missing:
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';

Suggest a fix

multipartFormData mustache is used without vendorExtensions so it's not detected

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions