Skip to content

Improve default IsValidResponseToDeserialize implementation#560

Merged
rose-a merged 7 commits into
graphql-dotnet:masterfrom
mikocot:bugfix/ensure-responsecontent-type
May 8, 2023
Merged

Improve default IsValidResponseToDeserialize implementation#560
rose-a merged 7 commits into
graphql-dotnet:masterfrom
mikocot:bugfix/ensure-responsecontent-type

Conversation

@mikocot

@mikocot mikocot commented Apr 27, 2023

Copy link
Copy Markdown
Contributor

As mentioned in issue #554 the default implementation of IsValidResponseToDeserialize currently does not verify if the response actually can be deserialized, regardless of its name.

As it's a logical OR it completely ignores the ContentType as long s the status matches Ok or BadRequest. At the same time it's possible that a server or any other component even before reaching the server returns one of those statuses in incorrect ContentType. Such behavior ends up with an ugly runtime exception, while it can be easily handled.

I also made this method more readable and debuggable. It's discussable if AcceptedResponseContentTypes should be editable and exposed.

Comment thread src/GraphQL.Client/GraphQLHttpClientOptions.cs Outdated
Comment thread src/GraphQL.Client/GraphQLHttpClientOptions.cs Outdated
Comment thread src/GraphQL.Client/GraphQLHttpClientOptions.cs Outdated
@sungam3r

Copy link
Copy Markdown
Member

It's discussable if AcceptedResponseContentTypes should be editable and exposed.

I'm fine to keep it private for now.

@sungam3r sungam3r added the enhancement New feature or request label Apr 27, 2023
Comment thread tests/GraphQL.Client.Serializer.Tests/DefaultValidationTest.cs Outdated
@rose-a rose-a changed the title Ensure reponse is deserializable in default IsValidResponseToDeserialize implementation Improve default IsValidResponseToDeserialize implementation Apr 27, 2023

@rose-a rose-a left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you contribution, please apply the suggested changes, then I'm fine to merge this...

Comment thread src/GraphQL.Client/GraphQLHttpClientOptions.cs Outdated
mikocot and others added 3 commits April 28, 2023 11:00
Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
Co-authored-by: Ivan Maximov <sungam3r@yandex.ru>
@mikocot

mikocot commented Apr 28, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for you contribution, please apply the suggested changes, then I'm fine to merge this...

Thanks, I believe it's all corrected now.

Comment thread src/GraphQL.Client/GraphQLHttpClientOptions.cs Outdated
@mikocot

mikocot commented May 2, 2023

Copy link
Copy Markdown
Contributor Author

hm, something doesn't seem right in the workflow, it has timeout at the default GH time limit of 6h, while the previous run was ok

@rose-a

rose-a commented May 3, 2023

Copy link
Copy Markdown
Collaborator

Yep, GraphQL.Integration.Tests.dll never finishes... Happening too in other PRs (like #557), but not locally...

@mikocot

mikocot commented May 4, 2023

Copy link
Copy Markdown
Contributor Author

hm, maybe a deadlock in xunit? I've seen with some asp.net core integration tests. It would only happen if several tests used the same classfixtures of custom WebApplicationFactory. In ended up to be bound to OTEL tracing and the workaround was to not configure it for testing.

However, the same might happen with other 'shared' components. According to xunit authors it's intentional... It might happen only on some machines depending on the amount of cores and runner setup. On the other hand when I run all the tests locally I get some failed ones, unrelated to my changes, so I might be having something missing in the environment, didn't have time to investigate.

@mikocot

mikocot commented May 5, 2023

Copy link
Copy Markdown
Contributor Author

can you restart the workflow? I dont seem to have rights

@rose-a rose-a merged commit f1a5bf8 into graphql-dotnet:master May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants