Describe the feature
Feature Request:
orpc currently always uses application/json as the Content-Type for OpenAPILink and other generated links (not sure). While this works for most cases, some APIs require different content types such as:
application/x-www-form-urlencoded
multipart/form-data
When using these content types, the request payload must be encoded differently than JSON.
Problem
There is no way to override Content-Type per operation, which prevents calling endpoints that do not accept JSON request bodies.
Expected Behavior
- Allow overriding
Content-Type per OpenAPI operation or link.
- Automatically serialize request data based on the selected content type.
Examples (JavaScript)
application/json
fetch("/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
username: "help",
password: "help",
}),
})
application/x-www-form-urlencoded
fetch("/login", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
username: "help",
password: "help",
}),
})
multipart/form-data
const form = new FormData()
form.append("username", "help")
form.append("password", "help")
fetch("/login", {
method: "POST",
body: form,
})
Use Case
Required for authentication endpoints, legacy APIs, and form-based submissions that do not accept JSON payloads.
Additional information
Describe the feature
Feature Request:
orpccurrently always usesapplication/jsonas theContent-TypeforOpenAPILinkand other generated links (not sure). While this works for most cases, some APIs require different content types such as:application/x-www-form-urlencodedmultipart/form-dataWhen using these content types, the request payload must be encoded differently than JSON.
Problem
There is no way to override
Content-Typeper operation, which prevents calling endpoints that do not accept JSON request bodies.Expected Behavior
Content-Typeper OpenAPI operation or link.Examples (JavaScript)
application/jsonapplication/x-www-form-urlencodedmultipart/form-dataUse Case
Required for authentication endpoints, legacy APIs, and form-based submissions that do not accept JSON payloads.
Additional information