Closed
Description
Given a path that accepts a put operation with a text/plain body:
info:
title: Demo
version: '1.0'
swagger: '2.0'
paths:
'/agency':
put:
consumes:
- text/plain
produces:
- text/plain
parameters:
- in: body
name: agency
required: true
schema:
type: string
example: "123"
responses:
'200':
description: OK
schema:
type: string
The generated client code for axios does not set the Content-Type. The Content-Type header in the http request is not set.
agencyUpdate: (agency: string, params: RequestParams = {}) =>
this.request<string, any>({
path: `/agency`,
method: "PUT",
body: agency,
...params
})
If in the generated code the type is added manually, the Content-Type header is set as specified:
agencyUpdate: (agency: string, params: RequestParams = {}) =>
this.request<string, any>({
path: `/agency`,
method: "PUT",
type: "text/plain" as any,
body: agency,
...params
})
Expected behavior: The type should be set according to the "consumes" definition (and the typing of type should be adapted)
Metadata
Metadata
Assignees
Labels
No labels