ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
4.96k stars 722 forks source link

Do not emit `"query": ""` for Strawberry Shake persisted queries #7062

Closed tobias-tengler closed 1 month ago

tobias-tengler commented 1 month ago

When activating persisted queries with Strawberry Shake, it currently produces the following POST body:

{
  "id":"692cb0da9a40c00ced7bba7463391db7",
  "query":"",
  "operationName":"BlogPagesById",
  "variables": { /* Omitted */ }
}

The "query": "" part is problematic, since a Hot Chocolate server with the UseOnlyPersistedQueriesAllowed middleware will now reject the request.

I fixed this by setting the query on OperationRequest explicitly to null, so it will be correctly omitted when building the JSON payload. I also removed the unreferenced and unsupported RequestStrategy.AutomaticPersistedQuery to avoid confusion.

github-actions[bot] commented 1 month ago

Qodana for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked ☁️ View the detailed Qodana report

Contact Qodana team Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - Or via our issue tracker: https://jb.gg/qodana-issue - Or share your feedback: https://jb.gg/qodana-discussions
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 71.87%. Comparing base (0864cd5) to head (658d0d7).

Files Patch % Lines
...yShake/Client/src/Transport.Http/HttpConnection.cs 70.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7062 +/- ## ========================================== - Coverage 72.11% 71.87% -0.24% ========================================== Files 2621 2607 -14 Lines 130776 130140 -636 ========================================== - Hits 94309 93543 -766 - Misses 36467 36597 +130 ``` | [Flag](https://app.codecov.io/gh/ChilliCream/graphql-platform/pull/7062/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ChilliCream) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/ChilliCream/graphql-platform/pull/7062/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ChilliCream) | `71.87% <70.00%> (-0.24%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ChilliCream#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.