-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client): ensure urls have trailing slashes (#361)
* fix(client): ensure urls have trailing slashes Some API routes need to have a trailing slash on the end. If they don't, you can see errors such as 404, 405, 307, etc. Closes https://linear.app/prefect/issue/PLA-948/workspace-create-fails-with-404-when-endpoint-is-set Closes #359 * Add script to check for trailing slash routes Adds a script to help check which routes have trailing slashes. * Flows: put trailing slash on the right field * Add note to contributing docs
- Loading branch information
1 parent
c2f14e1
commit 532de87
Showing
6 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script checks for all endpoints that require a trailing slash. | ||
# Files in internal/client/*.go should be checked to confirm that any | ||
# `url` fields in the request configuration include the trailing slash | ||
# when needed. | ||
# | ||
# This helps avoid errors like https://github.com/PrefectHQ/terraform-provider-prefect/issues/359. | ||
# | ||
# It can be helpful to redirect the output to a file for further analysis: | ||
# | ||
# ./scripts/trailing-slash-routes > trailing-slash-routes.json | ||
# | ||
# You can then use tools like `jq` to parse the results. | ||
# | ||
# Example output: | ||
# | ||
# [ | ||
# { | ||
# "path": "/api/accounts/{account_id}/teams/", | ||
# "method": "post", | ||
# "desc": "Create or update a team's metadata.\n\nRequired account permissions: `create:team`" | ||
# }, | ||
# { | ||
# "path": "/api/accounts/{account_id}/bots/", | ||
# "method": "post", | ||
# "desc": "Create a Bot\n\nRequired account permissions: `create:bot`" | ||
# }, | ||
# ... | ||
# } | ||
|
||
curl -s https://api.prefect.cloud/api/openapi.json | | ||
jq '.paths | ||
| to_entries | ||
| map({path: .key, method: (.value | to_entries[0].key), desc: (.value | to_entries[0].value.description)}) | ||
| map(select(.path | test("/$")))' |