-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
For post requests that have no payload, but content-type is required, a requestBody definition is required so that oats will populate that request header.
This swagger produces the following ts:
openapi: 3.0.0
info:
title: Test API
version: 0.0.0
servers:
- url: ''
paths:
/a:
post:
parameters:
- in: header
name: Content-Type
required: true
schema:
type: string
default: 'text/plain; charset=utf-8'
responses:
'200':
description: Success
/b:
post:
requestBody:
required: true
content:
text/plain; charset=utf-8:
schema:
type: object
responses:
'200':
description: Successexport interface PostAParams {
headers: {
"Content-Type": string;
};
}
export const postA = (
params: PostAParams,
options: RequestOptions = {}
): Promise<PostAResult> =>
request("POST", "/a", params, options) as Promise<PostAResult>;
export const postB = (
params: PostBParams,
options: RequestOptions = {}
): Promise<PostBResult> =>
request(
"POST",
"/b",
{ ...params, headers: { "Content-Type": "text/plain; charset=utf-8" } },
options
) as Promise<PostBResult>;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels