-
-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Labels
bug 🔥Something isn't workingSomething isn't workingclientClient package relatedClient package relatedjavascriptPull requests that update Javascript codePull requests that update Javascript code
Description
Description
Following the change introduced in #2406
The request body is not included in the request when the content type is text/plain.
The fetch client sdk outputs the following example:
export const postExample = <ThrowOnError extends boolean = false>(options: Options<postExampleData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).post<postExampleResponses, postExampleErrors, ThrowOnError>({
bodySerializer: null,
security: [
{
scheme: 'bearer',
type: 'http'
}
],
url: '/example/path',
...options,
headers: {
'Content-Type': 'text/plain',
...options.headers
}
});
};
When using the sdk and calling postExample({ body: 'data as a string' }) where the endpoint is expecting a post body, the call will fail because there is no body.
Reproducible example or configuration
Example open api spec and sdk output provided
OpenAPI specification (optional)
/example/path:
post:
...
requestBody:
required: true
content:
text/plain:
schema:
type: string
title: Sample Title
System information (optional)
@hey-api/openapi-ts 0.80.0
mrlubos
Metadata
Metadata
Assignees
Labels
bug 🔥Something isn't workingSomething isn't workingclientClient package relatedClient package relatedjavascriptPull requests that update Javascript codePull requests that update Javascript code