hey-api / openapi-ts

✨ Turn your OpenAPI specification into a beautiful TypeScript client
https://heyapi.vercel.app
Other
1.07k stars 88 forks source link

Support microsoft office Content-Type as binary #677

Closed karmats closed 1 month ago

karmats commented 3 months ago

Description

To be able to download Excel or Word files support for Content-Type: application/vnd.openxmlformats-officedocument.* is needed.

https://github.com/hey-api/openapi-ts/blob/a4eef0fa4f2de71b6af1aed2e09c6caec17f72fc/packages/openapi-ts/src/templates/core/fetch/getResponseBody.hbs#L6 Should add 'application/vnd.openxmlformats-officedocument'. Maybe also 'application/vnd.ms-excel' and 'application/msword'.

mrlubos commented 3 months ago

Can you use the new Fetch API client for this?

karmats commented 3 months ago

That might work @mrlubos. I will have a look and get back to you.

karmats commented 3 months ago

It works with Fetch API client but the code changes needed to use this instead of the (legacy?) fetch-client in our applications (and the fact that it's still in beta) is not something we can do now. We will wait for a stable 1.0 version. I found a solution to this problem by using a response interceptor.