Using a request body of type content: multipart/form-data breaks the headers generated by hey-api for solid query.
Compared to other methods that do not use form data, the library decides to generate a client post method that overwrites all headers (incorrectly) in order to set the content-type to null to respect browser boundaries.
import { defineConfig } from '@hey-api/openapi-ts';
defineConfig({
client: '@hey-api/client-fetch',
input: '<path to yaml>',
output: { path: '<path to output>', format: 'prettier'}
plugins: ['@tanstack/solid-query']
})
OpenAPI specification (optional)
< endpoint url >:
post:
summary: <summary>
operationId: <name here>
parameters:
... can be provided upon request. they are just 3 string parameters in the path that are required.
-$ref: <ref to accept header here>
-$ref: <ref to source header here>
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
Description
Using a request body of type content: multipart/form-data breaks the headers generated by hey-api for solid query.
Compared to other methods that do not use form data, the library decides to generate a client post method that overwrites all headers (incorrectly) in order to set the content-type to null to respect browser boundaries.
Example: (broken headers behavior)
This behavior makes it so the method ignores all headers passed in, such as required Accept headers.
This is what should happen: (What I do to fix the behavior is pass the options.headers through spread syntax).
Reproducible example or configuration
OpenAPI specification (optional)
System information (optional)
node v18.20.1 @hey-api/openapi-ts ^0.53 @hey-api/client-fetch ^0.24
@tanstack/solid-query plug.
Note: It does not matter what headers I specify in the .yaml, the method generated for the form data does not respect them.