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

struct literal of URL very easy to misuse #19

Open
John-Colvin opened this issue Dec 16, 2019 · 1 comment
Open

struct literal of URL very easy to misuse #19

John-Colvin opened this issue Dec 16, 2019 · 1 comment

Comments

@John-Colvin
Copy link

e.g. URL("http://www.google.com") compiles but very much does not do what it looks like.

@FigmentEngine
Copy link

FigmentEngine commented Jun 30, 2020

missing final slash after host causes problems:
URL url;

`

if (tryParseURL("example.com/?" ~ "country=france", url)) {
	string country = url.queryParams["country"].front;
	writefln("Url %s QS %s", url, country);
}`

works, but this won't as it won't find the query string due to the lack of the forward slash
`

if (tryParseURL("example.com?" ~ "country=france", url)) {
	string country = url.queryParams["country"].front;
	writefln("Url %s QS %s", url, country);
}`

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