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

Add trailing slash to the graphql URLs #3389

Merged
merged 7 commits into from
Sep 30, 2024
Merged

Conversation

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.

Project coverage is 80.51%. Comparing base (fbeb09b) to head (598df38).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pontoon/api/tests/test_urls.py 50.00% 4 Missing ⚠️
Additional details and impacted files

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

Copy link
Collaborator

@flodolo flodolo left a comment

Choose a reason for hiding this comment

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

  1. Do we want to update the links in the documentation?

BTW, the curl example doesn't work on macOS+zsh without quotes

curl --globoff "http://localhost:8000/graphql?query={projects{name}}"
  1. As I mentioned in the other PR, this works in the browser on DEV where the URL is redirected (e.g. graphql?query={projects{name}}graphql/#query=%7B%0A%20%20projects%20%7B%0A%20%20%20%20name%0A%20%20%7D%0A%7D.

But it doesn't work when I try with curl (even on DEV, no need to switch to PROD): I get an empty answer, while if I manually add the / I get an answer.

$ curl --globoff -w "\nStatus code: %{http_code} \n" "http://localhost:8000/graphql?query={projects{name}}"


Status code: 301
$ curl --globoff -w "\nStatus code: %{http_code} \n" "http://localhost:8000/graphql/?query={projects{name}}"

{"data":{"projects":[{"name":"Terminology"}]}}
Status code: 200

pontoon/api/tests/test_urls.py Outdated Show resolved Hide resolved
@mathjazz
Copy link
Collaborator Author

Explicitly added support for the URLs with trailing slashes.

I've updated the docs, to make the URLs consistent with the TM and Terminology download URLs.

@mathjazz
Copy link
Collaborator Author

BTW, the curl example doesn't work on macOS+zsh without quotes

I couldn't reproduce that.

Copy link
Collaborator

@flodolo flodolo left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏼

Can we quote the curl addresses with {} though? This works in both bash and zsh

pontoon/api/README.md Outdated Show resolved Hide resolved
pontoon/api/README.md Outdated Show resolved Hide resolved
mathjazz and others added 2 commits September 30, 2024 16:15
Co-authored-by: Francesco Lodolo <flod@lodolo.net>
Co-authored-by: Francesco Lodolo <flod@lodolo.net>
@mathjazz mathjazz merged commit 6a8744b into mozilla:main Sep 30, 2024
2 checks passed
@mathjazz mathjazz deleted the graphql-url branch September 30, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants