graphql-dotnet / graphql-dotnet/graphql-client
Can't easily add "event" or override for what happens after reading the HttpClient response.
- Dominant language
- C#
- Stars
- 648
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
As part of using the the GraphQLHttpClient, I need to be able to log the full request sent and response received. I can do the former by subclassing GraphQLRequest (which isn't the obvious way to do it, but no matter), but I can't see any obvious way of doing the latter, given the way that SendQueryAsync is written. In particular I need to be able to log the response regardless of any errors processing the response (parsing or otherwise).
It seems that the only way I can really do it is override SendQueryAsync and replace it with a copy of the base implementation that adds in the logging hooks, which doesn't seem too nice, esp. because SendQueryAsync is not declared virtual in GraphQLHttpClient, meaning I can't even use the SendQueryAsync in GraphQLClientExtensions.
Is there any plan to add such a facility?
I will say the need to read the entire response as a string and log it does mean you have to copy to, say, a MemoryStream first, so it would require quite some change to the current implementation of SendQueryAsync.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.