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

Handle path argument of URL.build, which doesn't start from / #242

Closed
rominf opened this issue Sep 27, 2018 · 4 comments
Closed

Handle path argument of URL.build, which doesn't start from / #242

rominf opened this issue Sep 27, 2018 · 4 comments

Comments

@rominf
Copy link
Contributor

rominf commented Sep 27, 2018

I'm building URL with this line of code:

url = URL(scheme='https', host='profile-srv.kama.gs', path='oauth/token')

Then I pass url to session.post and get 400 error.

When I construct it with:

url = URL(scheme='https', host='profile-srv.kama.gs', path='/oauth/token')

or convert it to str:

url = str(URL(scheme='https', host='profile-srv.kama.gs', path='/oauth/token'))

everything is OK.

I suggest prepending / if path doesn't start with / or, at least, raise an exception.

@asvetlov
Copy link
Member

I think the rule should be: URLs with authority (host part not empty) should raise ValueError on processing relative path (not started with /).

Would you provide a patch?

@rominf
Copy link
Contributor Author

rominf commented Sep 27, 2018

@asvetlov, OK, I will, wait.

@rominf
Copy link
Contributor Author

rominf commented Sep 27, 2018

@asvetlov, see #243

@asvetlov
Copy link
Member

Fixed by #243

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

No branches or pull requests

2 participants