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

Fix issue with FastAPI mounts. #1183

Merged
merged 8 commits into from
Feb 14, 2024
Merged

Fix issue with FastAPI mounts. #1183

merged 8 commits into from
Feb 14, 2024

Conversation

nsthorat
Copy link
Contributor

No description provided.

@@ -98,7 +98,11 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
url = URL(scope=scope).path
root_path = scope.get('root_path') or ''
ends_with_slash = (
url.endswith('/') and url != '/' and root_path and not url.startswith(root_path + '/api')
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make this a unit test to enumerate the kinds of URLs that this does/doesn't accept?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


curl --fail --silent "http://localhost:$PORT/lilac_sub/"
curl --fail --silent "http://localhost:$PORT/$MOUNT_PATH/api/v1/tasks/" > /dev/null
curl --fail --silent "http://localhost:$PORT/$MOUNT_PATH/" --max-redirs 0 > /dev/null

Choose a reason for hiding this comment

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

Suggested change
curl --fail --silent "http://localhost:$PORT/$MOUNT_PATH/" --max-redirs 0 > /dev/null
curl --fail --silent "http://localhost:$PORT/$MOUNT_PATH/" -L --max-redirs 0 > /dev/null

Need to add -L (follow redirects) for --max-redirs to have any effect

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! Done :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to migrate this to a python test, FYI.

@nsthorat nsthorat merged commit 640ac0a into main Feb 14, 2024
4 checks passed
@nsthorat nsthorat deleted the nik-integy branch February 14, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants