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

Remove ? from the end of the path when logging #214

Closed
paulcsmith opened this issue Nov 12, 2017 · 2 comments
Closed

Remove ? from the end of the path when logging #214

paulcsmith opened this issue Nov 12, 2017 · 2 comments

Comments

@paulcsmith
Copy link
Member

paulcsmith commented Nov 12, 2017

When using LuckyWeb::HttpMethodOverrideHandler the logs output an extra ? at the end of the path

screen shot 2017-11-12 at 11 41 48 am

https://github.com/luckyframework/web/blob/master/src/lucky_web/http_method_override_handler.cr

Here's the line that output the path to the logs. https://github.com/luckyframework/web/blob/master/src/lucky_web/log_handler.cr#L15

-Maybe switching from context.request.path instead of context.request.resource would do the trick?-

Turns out this is an issue on Crystal. I opened a PR there (crystal-lang/crystal#5340). Once it is merged this should be fixed.

@paulcsmith paulcsmith changed the title Remove ? from the end of the path Remove ? from the end of the path when logging Nov 12, 2017
@paulcsmith
Copy link
Member Author

I tried with path and it works, but then it won't log query params. So there has to be some other solution

@paulcsmith paulcsmith added this to the Ready for most projects milestone Nov 24, 2017
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 1, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`
@paulcsmith
Copy link
Member Author

Turns out this is an issue on Crystal. I opened a PR there (crystal-lang/crystal#5340). Once it is merged this should be fixed.

paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 1, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 1, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 1, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 2, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 2, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`.
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 2, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`.
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 2, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`.
paulcsmith added a commit to paulcsmith/crystal that referenced this issue Dec 2, 2017
I found this while investigating this issue on Lucky:
luckyframework/lucky#214

It turns out that because I parsed the query params in that handler it
set the URI#query to `""`. This caused `HTTP::Request#resource` to add
an extra `?` to the end of the path, even though the query params were
empty.

This PR fixes the issue by also checking for an empty string before
printing `?`.
djuber pushed a commit to djuber/lucky that referenced this issue Aug 29, 2021
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

1 participant