Skip to content

How to intercept the response pipeline? #4901

Answered by andrueastman
galvesribeiro asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for trying out Kiota @galvesribeiro

I'm not sure which language you are using with Kiota, however, to achieve this in C#, you can write a custom Delegating Handler that is added to the request pipeline(You can check out the compressionHandler that already does some of the stuff you wish at https://github.com/microsoft/kiota-http-dotnet/blob/main/src/Middleware/CompressionHandler.cs)

Once you write the custom middleware, you can then leverage the client factory to add the handler to a client so that this is handled in the response cycles by creating a HttpClient as below.

var handlers = KiotaClientFactory.CreateDefaultHandlers();
var myCustomCompressionHandler = new CompressionHandler(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@galvesribeiro
Comment options

Answer selected by galvesribeiro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants