Giter Site home page Giter Site logo

Comments (13)

mrlubos avatar mrlubos commented on September 27, 2024 1

Risky change of the day will be changing the type for blob into application/ 🤞

from openapi-ts.

mrlubos avatar mrlubos commented on September 27, 2024 1

@tadejsv I will release a proper fix for this, maybe tomorrow?

from openapi-ts.

stackblitz avatar stackblitz commented on September 27, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from openapi-ts.

tormodAase avatar tormodAase commented on September 27, 2024

I don't think it would be correct to assume that all vendor media types should be parsed as binary. Vendor media types has many different formats:
https://www.iana.org/assignments/media-types/media-types.xhtml#application

If you need a quickfix to your specific issue, perhaps you could create a response interceptor?

client.interceptors.response.use(async (response) => {
    if (response.headers.get("Content-Type")?.includes("application/vnd")) {
        response.headers.set("Content-Type", "application/zip");
    }
    return response;
})

from openapi-ts.

tadejsv avatar tadejsv commented on September 27, 2024

Hm, from the list you sent it seems a lot of formats have +json in their name to signal they are JSON - perhaps a better default would be to assume we have binary unless there is +json? And in general, I think 90% of the formats there are bonary, so treating then as sich would be a better default than json

In any case, will try your proposed solution, thanks.

from openapi-ts.

tadejsv avatar tadejsv commented on September 27, 2024

@tormodAase unfortunately your fix does not work, as headers are immutable

from openapi-ts.

tadejsv avatar tadejsv commented on September 27, 2024

@mrlubos I think a long term solution would be enabling the user to provide custom mapping between content types and different types of parsing :)

from openapi-ts.

mrlubos avatar mrlubos commented on September 27, 2024

You can always specify manually which one you'd like by configuring the service/client call by passing parseAs, but yes that could be also a consideration

from openapi-ts.

tadejsv avatar tadejsv commented on September 27, 2024

@mrlubos oh thanks, I was not aware of this option! This solves my problem

from openapi-ts.

mrlubos avatar mrlubos commented on September 27, 2024

@tadejsv I assume the correct setting would be blob in this case?

from openapi-ts.

tadejsv avatar tadejsv commented on September 27, 2024

Yes

from openapi-ts.

mrlubos avatar mrlubos commented on September 27, 2024

I linked a fix, but might wait with publishing it for a few days. I am quite positive it will break application/x-www-form-urlencoded so need to handle that too

from openapi-ts.

mrlubos avatar mrlubos commented on September 27, 2024

@tadejsv in the meantime, you can manually remove the header by passing headers to the call/client/wherever necessary

{
  'Content-Type': null, // <-- this will clear the header
}

from openapi-ts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.