openapi-typescript-fetch icon indicating copy to clipboard operation
openapi-typescript-fetch copied to clipboard

OpenApi3 and "application/json;charset=UTF-8"

Open doktordirk opened this issue 3 years ago • 1 comments
trafficstars

Thanks for you nice work!

We use application/json;charset=UTF-8 and not just application/json as it is assumed in types.d.ts and hence the response data type becomes unknown.

I wonder if it's possible to extend

Fetcher.for<paths>(); to optional Fetcher.for<paths, 'application/json;charset=UTF-8'>();

and/or

fetcher.path('/xzy').method('get').create(); to optional fetcher.path('/xyz').method<'application/json;charset=UTF-8'>('get').create();

doktordirk avatar Jan 02 '22 15:01 doktordirk

JSON should always be utf-8 so specifying it as such is redundant. See eg: https://en.wikipedia.org/wiki/JSON#Character_encoding

voxpelli avatar Oct 28 '22 22:10 voxpelli