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

Support for multiple slash #259

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions test/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,22 @@ wait_for_pod_ready model=gemma2-2b-cpu

curl -s -X GET "http://localhost:8000/openai/v1/models" | jq '. | length == 4'

curl http://localhost:8000/openai/v1/completions \
-H "Content-Type: application/json" \
-d '{"model": "gemma2-2b-cpu", "prompt": "Who was the first president of the United States?", "max_tokens": 40}'
function test_completion() {
local url="$1"
http_code=$(curl -L -o /tmp/curl-output -w '%{http_code}' ${url} \
-H "Content-Type: application/json" \
-d '{"model": "gemma2-2b-cpu", "prompt": "Who was the first president of the United States?", "max_tokens": 40}')
if [[ "$http_code" != "200" ]]; then
echo "Failed to get completions from $url"
echo "HTTP code: $http_code"
cat /tmp/curl-output
exit 1
fi
}

test_completion "http://localhost:8000/openai/v1/completions"
# Double slash in the URL should work as well.
test_completion "http://localhost:8000/openai//v1/completions"
Copy link
Contributor

Choose a reason for hiding this comment

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

This fails with 'HTTP code: 301'

You can use a curl param to follow the redirect or just assert the 301 with the correct target

-L, --location
              (HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option
              makes curl redo the request on the new place. If used together with -i, --include or -I, --head, headers from all requested pages are shown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! This now correctly follows and shows the 400 error.

Copy link
Contributor Author

@samos123 samos123 Sep 30, 2024

Choose a reason for hiding this comment

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

weird, on my local curl I can reproduce 400 error, but seems the automated test does not. See here: #257 (comment)


# Test the speech to text endpoint
wait_for_pod_ready model=faster-whisper-medium-en-cpu
Expand Down
Loading