Skip to content

Add interceptors for .NET HTTP #3334

Draft
xiazcy wants to merge 1 commit intodotnet-httpfrom
dotnet-http-interceptors
Draft

Add interceptors for .NET HTTP #3334
xiazcy wants to merge 1 commit intodotnet-httpfrom
dotnet-http-interceptors

Conversation

@xiazcy
Copy link
Contributor

@xiazcy xiazcy commented Mar 19, 2026

Currently targeting the feature branch for easy diff checking, will rebase and update once the non-streaming HTTP PR get merged.

@kenhuuu
Copy link
Contributor

kenhuuu commented Mar 20, 2026

There's a bit of a design issue with the way this is currently implemented. The HttpRequestContext allows for setting/getting the body, but the body is immediately serialized before the interceptors run and the only supported serializer is GraphBinary. This means that users really have no chance to modify the body at all and they can only read it, otherwise, their interceptor would need to deserialize the body, make changes and then re-serialize.

In my opinion, one of two things need to be changed:

  • split Auth away from interceptors and remove Body from interceptors to make it clear that only headers can change in interceptors but Auth can read the body
  • Don't serialize immediately and put the body in a form that is easily modifiable, but this will require more understanding from the user about how the system works. This is effectively what the Java driver does.

Base automatically changed from dotnet-http-connection to dotnet-http March 20, 2026 18:36
Squashed commits:
[5ca9f87] minor improvements to auth
[7c4b05f] Fix examples
[70de6bf] fix auth tests
[5a89d22] Add interceptor to .net with new reference auth class
@xiazcy xiazcy force-pushed the dotnet-http-interceptors branch from d04f5d4 to 832b711 Compare March 20, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants