Skip to content
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

Improve default IsValidResponseToDeserialize implementation #560

Merged

Conversation

mikocot
Copy link
Contributor

@mikocot mikocot commented Apr 27, 2023

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.

@sungam3r
Copy link
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
@rose-a rose-a changed the title Ensure reponse is deserializable in default IsValidResponseToDeserialize implementation Improve default IsValidResponseToDeserialize implementation Apr 27, 2023
Copy link
Collaborator

@rose-a rose-a left a comment

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...

src/GraphQL.Client/GraphQLHttpClientOptions.cs Outdated Show resolved Hide resolved
@mikocot
Copy link
Contributor Author

mikocot commented Apr 28, 2023

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

Thanks, I believe it's all corrected now.

@mikocot
Copy link
Contributor Author

mikocot commented May 2, 2023

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
Copy link
Collaborator

rose-a commented May 3, 2023

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

@mikocot
Copy link
Contributor Author

mikocot commented May 4, 2023

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
Copy link
Contributor Author

mikocot commented May 5, 2023

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