openapi-typescript-fetch
openapi-typescript-fetch copied to clipboard
Allow responses other that json (or plain text)
Atm, other formats are not allowed. To be backwards compatible, one option could be to always also return the original response
async function getResponseData(response: Response) {
// ...
const text = await response.clone().text()
//...
}
async function fetchJson(url: string, init: RequestInit): Promise<ApiResponse> {
//...
const result = {
...response,
data,
}
//...
}
It really should not throw if the spec defines the response as plain/text and the status is 200. What is a good work-around for that?