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

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

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

tobias-tengler
Copy link
Collaborator

@tobias-tengler tobias-tengler commented Apr 15, 2024

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.

Copy link

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

@tobias-tengler tobias-tengler changed the title Fix ss persisted queries Do not emit "query": "" for Strawberry Shake persisted queries Apr 15, 2024
Copy link

codecov bot commented Apr 15, 2024

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 ⚠️
Additional details and impacted files
@@            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 Coverage Δ
unittests 71.87% <70.00%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michaelstaib michaelstaib merged commit 38de4ac into main Apr 15, 2024
89 of 101 checks passed
@michaelstaib michaelstaib deleted the fix-ss-persisted-queries branch April 15, 2024 17:24
@PascalSenn PascalSenn mentioned this pull request May 22, 2024
@PascalSenn PascalSenn mentioned this pull request Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants