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

Support for multiple slash #259

wants to merge 6 commits into from

Conversation

samos123
Copy link
Contributor

@samos123 samos123 commented Sep 29, 2024

Fix for #257

@samos123 samos123 changed the title add integration test for multiple slash Support for multiple slash Sep 30, 2024

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)

@samos123
Copy link
Contributor Author

@alpe if you have some ideas on how to fix this, feel free to just take my test and submit a PR. I haven't started looking into how to fix it yet.

@alpe
Copy link
Contributor

alpe commented Oct 1, 2024

👍 The test passes with the -L flag, now.
personal preference: I would focus on the happy path only in this test. The url redirect can be tested in Go instead

@samos123
Copy link
Contributor Author

samos123 commented Oct 3, 2024

I tried to reproduce in go but it ended up being too much work. I do agree that we should test this kind of thing in a unit test case instead.

Note the test case is failing as expected now, so need to figure out how to fix it.

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.

2 participants