Closed soonoo closed 3 weeks ago
Same question, but i am using client-fetch, and don't understand, how to set withCredentions
to true. Need Help
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
@grifondopala Are you using the legacy Fetch client or the standalone package?
I am using @hey-api/client-fetch
@soonoo I believe you're right about being hard-coded. This would be addressed by a standalone Axios client
@grifondopala you can pass any Fetch API arguments to the client when you're creating it. You could even supply your own fetch instance
@mrlubos you mean, that i should write
createClient({ withCredentials: true })
?
@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.
@mrlubos Than you!
createClient({ credentials: "include" })
works for me
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
I'm going to put a help wanted label on this as the new clients are a priority over maintaining the old ones
i wanted to use the new ones as well but the typescript of 5x is a deal breaker it breaks a lot of dependencies.
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
Or do you mean you can't use the openapi-ts package at all?
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.
@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?
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.
Which version are you on?
Going to close this issue, please consider upgrading to the new clients. If anyone needs it for the legacy clients, we are open to pull requests. @dagadbm please open a separate issue if you think the TypeScript requirement should be addressed
Description
It seems that
withCredentials
option is hard coded when using axios client.How can I set it?