-
Notifications
You must be signed in to change notification settings - Fork 440
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
Urls not correctly "currled" #37
Comments
Hello @chgad, Does the "try it out" function work from the web UI? (I.e. is it just the curl URL which has problems?) I tried, but can't manage to reproduce the issue. What python/rest-framework/Django versions are you using? Can you provide the generated swagger.yaml or .json spec for your api, or a minimal example which exhibits the issue? Thanks. |
I'm trying to figure out what happens, as I said, I can't manage to reproduce it. The json/yaml spec is the source of the documentation - you can get it by accessing ?format=openapi, or by using schema_view.without_ui(). Back to your problem, are you by any chance using path() instead of url() for routing your urls? Does the app itself work? |
Ah now i got it. here is the spec: Nope i'm not using path() and yes my app works just fine. I can't geive feedback about "live behavior" since the docs aren't online yet. |
Also how are you instantiating the schema view, and how are you accesing it in the browser? (i.e. the full URL) - it's strange to see that it picks up |
I instatiate it as it's said in the "Getting started", no customization. i acces it via |
Hello, I think I have some ideas:
|
Yeah! The Problem was that i declared an incorrect url in the I declared This fact of an absoulute url could be stated in the docs (?). It would definetly clarify it abit to prevent further Problems with the url. Thanks for the fast and coninuous help. |
Re-opening to remember to improve handling of this. |
* added handling of basePath by taking into account SCRIPT_NAME and the longest common prefix * improved handling of NamespaceVersioning by excluding URLs of differing versions * added documentation and error messages for the problem reported in #37
Hi,
i encountered the following:
when clicking "try it out!" in one of my GET Endpoints the curl prompt beneath it states a wrong statement :
curl -X GET "localhost://localhost:8000/api/myendpoint/(P101[0-9]+)" -H "accept: application/json" -H "X-CSRFToken: x4bdC0d9Chl2ZThQEpJCi1WzadO0NTIPVa5FXSqkIRvjJ9xvJvBzvZWZLvQ3viDC"
This is obviously a wrong behavior. The correct, and succesfull, curl should look like this :
curl -X GET "localhost:8000/api/myendpoint/101" -H "accept: application/json" -H "X-CSRFToken: x4bdC0d9Chl2ZThQEpJCi1WzadO0NTIPVa5FXSqkIRvjJ9xvJvBzvZWZLvQ3viDC"
my urls.py looks like this :
[...] url(r'^myendpoint/(?P<pk>[0-9]+)', myendpoint.as_view) [...]
This might be an "localhost" problem (I can not validate the issue for the production system, docs aren't online till now) , but still shouldn't ouccur.
The text was updated successfully, but these errors were encountered: