-
Notifications
You must be signed in to change notification settings - Fork 22
Bump and other fixes #161
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
Bump and other fixes #161
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| +1 −2 | src/auth/jwk_token.py | |
| +14 −2 | src/authorization/resolvers.py | |
| +3 −12 | tests/unit/auth/test_jwk_token.py | |
| +16 −2 | tests/unit/authorization/test_resolvers.py |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,7 +27,7 @@ case "${QUERY_ENV:-}" in | |||||||||||||||||||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| get_available_models() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl --silent --show-error -X 'GET' "${BASE_URL}/v1/models" -H 'accept: application/json' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl --silent --show-error -X 'GET' "${BASE_URL}/v1/models" -H 'accept: application/json' -H "Authorization: Bearer ${OCM_TOKEN}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
29
to
31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Harden token handling and HTTP error checks for models call. With set -u, Apply: get_available_models() {
- curl --silent --show-error -X 'GET' "${BASE_URL}/v1/models" -H 'accept: application/json' -H "Authorization: Bearer ${OCM_TOKEN}"
+ # Ensure token present (and fetch if not)
+ if [[ -z "${OCM_TOKEN:-}" ]]; then
+ if ! get_ocm_token; then
+ echo "Failed to get OCM token for models"
+ return 1
+ fi
+ fi
+ tmpfile=$(mktemp)
+ status=$(curl --silent --show-error --output "$tmpfile" --write-out "%{http_code}" \
+ -H 'accept: application/json' \
+ -H "Authorization: Bearer ${OCM_TOKEN}" \
+ "${BASE_URL}/v1/models")
+ body=$(cat "$tmpfile"); rm "$tmpfile"
+ if ! good_http_response "$status"; then
+ echo "Error: Failed to fetch models (HTTP $status)"
+ echo "Response: $body"
+ return 1
+ fi
+ echo "$body"
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| select_model() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.