-
Notifications
You must be signed in to change notification settings - Fork 209
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
fix: handle Accept
header
#1789
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1789 +/- ##
==========================================
- Coverage 86.88% 86.86% -0.03%
==========================================
Files 155 155
Lines 15581 15625 +44
==========================================
+ Hits 13538 13572 +34
- Misses 2043 2053 +10 ☔ View full report in Codecov by Sentry. |
@@ -43,6 +43,8 @@ type Query { | |||
```yml @test | |||
- method: POST | |||
url: http://localhost:8080/graphql | |||
headers: | |||
Accept: application/graphql-response+json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this logic into execution spec so that by default we make the request with headers and don't need to modify all the tess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accept there are changes in many tests files.
Realistically, headers comes form request which we define in tests files. That should be the source of truth.
Also it will be the problem for us to write tests for non compliance.
the non compliance tests i wrote fails.
@tusharmath
Accept
header
let count = req | ||
.headers() | ||
.get("Accept") | ||
.unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not do unwrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
let error_message = "Unsupported 'Accept' Header value in the request, required 'application/graphql-response+json'"; | ||
|
||
// enforce this only on/after 1/1/2025, just warn until then. | ||
if NaiveDate::from_ymd_opt(2025, 1, 1) <= Some(Local::now().date_naive()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the date check required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to draft, that requirement is must after that date.
so checking date.
But if we want to enforce that spec right from now, then not needed.
I am checking date to maintain compatibility with legacy applications and give some time for them to adopt.(according to spec.)
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put this header check in a separate function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. i also thought of that.
what about creating separate module to house all the logic to check spec.
like module: graphql_over_http ?
@tusharmath
Action required: PR inactive for 2 days. |
94530c2
to
8747347
Compare
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
@webbdays Whenever the PR is ready please mark it as ready to review. I think I missed your comments here. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
PR closed after 5 days of inactivity. |
Summary:
Issue Reference(s):
#1766
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>