-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to provide default middleware options in kiota factory #130
Comments
Hi @andreaTP |
done something but haven't finalized it at the time.
Yes, the server doesn't support it 🙂 , if you wanna keep the default turned on we should have an easy switch, e.g. a method on the |
I'm assuming the issue is only with requests which have a request body?
This way the only behaviour change we introduce in most cases is to stop compressing request bodies. For Microsoft Graph we'll have to coordinate to set the new options/middleware properly. As for "an easy switch", we'd have to think of a design that works across languages and doesn't produce a "global settings object" (mixing concerns). I think we could potentially have a design where the client factory accepts a set of default handler options for the requests. This way you could do something like this: kiotaHttp.GetDefaultClientWithOptions([] {compressionOptionYouWant]) Which would:
What do you think? |
Possible, I have experienced it on a POST and haven't dug deeper. Regarding how to roll out the change I don't have strong opinions, whatever fits the best for you. I thought about this a little more and:
|
We discussed that further internally. The downside of a dedicated middleware is that it will result in a lot of allocations at runtime. We could still add this overload with the default options, and have spaghetti code in there, the implementation would look something like this: if (options[keyForCompression] != nil) {
middlewares = append(middlewares, NewCompressionHandlerWithOptions(options[keyForCompression]))
} else {
middlewares = append(middlewares, NewCompressionHandler())
} This way the allocations only happen once per client, and rely on existing defaults mechanisms |
Hi everyone! 👋
I started building a new SDK in Go for Apicurio Registry, my experience performing a GET has been completely smooth, great job!
It required quite some digging to find out that an interceptor for compression is enabled by default, and that's surprising, I haven't found a better way to disable it than creating a new client without it:
My expectation would be: compression should be disabled by default and we should document how to toggle it on and off
The text was updated successfully, but these errors were encountered: