Comments (18)
@grifondopala no, you will want to pass the native Fetch API option which is credentials
. If you play with the StackBlitz example, you can see it's autocompleted in createClient()
. withCredentials
is the Axios API.
from openapi-ts.
@mrlubos Than you!
createClient({ credentials: "include" })
works for me
from openapi-ts.
Same question, but i am using client-fetch, and don't understand, how to set withCredentions
to true. Need Help
from openapi-ts.
I haven't tried it yet, but I see that the generated code is exporting an configuration object named OpenAPI. It seems like importing and directly changing it is possible.
OpenAPI.WITH_CREDENTIALS = true
from openapi-ts.
@grifondopala Are you using the legacy Fetch client or the standalone package?
from openapi-ts.
I am using @hey-api/client-fetch
from openapi-ts.
@soonoo I believe you're right about being hard-coded. This would be addressed by a standalone Axios client
from openapi-ts.
@grifondopala you can pass any Fetch API arguments to the client when you're creating it. You could even supply your own fetch instance
from openapi-ts.
@mrlubos you mean, that i should write
createClient({ withCredentials: true })
?
from openapi-ts.
Hey @soonoo, if you're able to switch to the new Axios client, it's available there simply as passing withCredentials
. More in the docs
from openapi-ts.
I'm going to put a help wanted label on this as the new clients are a priority over maintaining the old ones
from openapi-ts.
i wanted to use the new ones as well but the typescript of 5x is a deal breaker it breaks a lot of dependencies.
from openapi-ts.
Is it @dagadbm? Because the main package has the same requirement https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/package.json#L70
from openapi-ts.
Or do you mean you can't use the openapi-ts package at all?
from openapi-ts.
I have the 0.33.2 version but I cannot update it any further because of the typescript.
I think the only thing that I can't do is mimick the axios error:
axios.interceptors.response.use(processData, processErrors);
OpenAPI.interceptors.response.use((request) => {
if (request.status >= 200 || request.status <= 299) {
return processData(request);
} else {
const error = new AxiosError<DatafoldError>(
request.statusText,
request.status,
request.config,
request.request,
request,
);
return processErrors(error);
}
});
i dont think things map out 1:1 from what I see.
But I won't take any more of your time. Its incredible how much stuff has ben evolving here.
from openapi-ts.
@dagadbm I'll need to improve the Axios client, thanks for the feedback! That's a bummer about being stuck on v0.33.2, lots of good stuff since then. What kind of errors are you seeing? Any chance you know what has changed (presumably) in v0.34.0 that prevents you from upgrading?
from openapi-ts.
Its the typescript requirement of 5.0
I cannot update it on my side I get a whole bunch of other conflicts with other packages.
from openapi-ts.
Which version are you on?
from openapi-ts.
Related Issues (20)
- multipart/form-data with fetch client sends content-type application/json HOT 2
- Make `"auto"` the default `parseAs` option in `@hey-api/client-fetch` HOT 5
- Error with binary response HOT 8
- Wrong infered content type for excel documents HOT 13
- Transformed Date(s) in query ends up as empty string(s) HOT 3
- securitySchemes won't support GET api key authentication HOT 4
- fetch-client does not correctly handle multipart/form-data HOT 1
- Streaming HTTP query support HOT 2
- additionalProperties creates invalid key type
- Generated client-fetch services declares client locally, but it is not exported. HOT 2
- Fetch API docs don't match implementation HOT 7
- Some config options cannot be set through cli flags HOT 3
- Create explicit client interface
- Zod plugin HOT 4
- schemas.type form removes properties from schema HOT 1
- Cannot find name 'ThrowOnError' error TS2304 HOT 13
- Make `body` optional if all fields are optional
- `client-fetch` now required a `ThrowOnError` generic which breaks manually created services with `fetch-client` HOT 4
- ThrowOnError can not be set to true HOT 7
- client type error in services.gen.ts HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-ts.