cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Support json media types with charset #155

Closed haskelcurry closed 3 years ago

haskelcurry commented 3 years ago

The inferResponseType checks for ending of the media type:

if (mediaType.endsWith('/json') || mediaType.endsWith('+json')) {

But it's quite usual to have it like this:

  content:
    application/json; charset=utf-8:
      ...

Which breaks the inference and makes the responseType to be "blob". Proposed solution: It's enough for media type to include the "/json" and "+json" strings, not endsWith.