You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I access the server as http://localhost:5000/echo?text=Hello%20World the request.url() returns only /echo?text=Hello%20World.
Is there a method to get the full original URL?
If not then I think it would be useful to either change url to return that, or have another method that would return the full url.
The text was updated successfully, but these errors were encountered:
To construct the full address you need to get the Host header from the request and prepend it to the output of url(). This won't tell you if the request was made over HTTP or HTTPS though.
The reason url() doesn't do this by default is that you need to parse the full header section to be able to get that information, and we should be able to route without doing so.
Thanks. As far as I can see in order to parse the Url I need to supply a full URL including the protocol and the hostname to the url crate. Is there a better way to get the parameters sent via the QUERY_STRING?
The 'resource' part of the HTTP request is just a string, so you can take the string from url(), split it on ? and that will give you a string that is a & separated list of URLEncoded query parameters.
Tiny-http doesn't do this for you, it's typically implemented a layer up in the router for something like Rouille.
If I access the server as
http://localhost:5000/echo?text=Hello%20World
therequest.url()
returns only/echo?text=Hello%20World
.Is there a method to get the full original URL?
If not then I think it would be useful to either change
url
to return that, or have another method that would return the full url.The text was updated successfully, but these errors were encountered: