-
Notifications
You must be signed in to change notification settings - Fork 27
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 Interceptor Overload for Send #694
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #694 +/- ##
=======================================
Coverage 96.92% 96.93%
=======================================
Files 15 15
Lines 846 847 +1
Branches 193 193
=======================================
+ Hits 820 821 +1
Misses 22 22
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Ahhhhhhh. So that explains why that wasn't working. I'd noticed the interception wasn't working in one of our internal libraries, but I'd been able to work around it in the short term by disabling it from fetching the table metadata like noted in this blog post: https://aws.amazon.com/blogs/developer/improved-dynamodb-initialization-patterns-for-the-aws-sdk-for-net/ Mystery solved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try out the version from the PR with the internal library on Monday to check it solves the stuff I'd run into as well. If it does then we can do a 4.1(?) or whatever the next minor version will be.
@@ -0,0 +1 @@ | |||
#nullable enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new bit should go in the unshipped files until it actually gets to NuGet, then it'll get moved post-release.
However that's probably not worth doing if we just ship this on Monday with no other changes.
#if NET6_0_OR_GREATER | ||
/// <inheritdoc /> | ||
protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) => | ||
SendAsync(request, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is a bit ick, but as it's a test library and probably quite a minority subset of cases (as it's taken 2 years to hit this) this is fine.
Sounds good to me, I inherited the interceptor with this change added in the application I ran into the sync call issue in and it seemed to work, so 🤞🏼 |
Changes validated internally. |
This PR adds an override to
InterceptingHttpMessageHandler
for the synchronousSend
method ofDelegatingHandler
to allow for calls toHttpClient.Send
to be intercepted.First pass includes some pretty icky sync-over-async 😢 , however, to avoid this would require some significant re-writes for what feels like a bit of an edge-case.
I've added this, as after upgrading a project to .NET 8 with
AWSSDK.DynamoDBv2
versions >3.7.300
, I had some failing tests due to some AWS calls not being intercepted due to using the synchronousHttpClient.Send
overload (here)