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
Decode percent encoded strings in parameters #33
Conversation
Are you working with Vapor in Xcode? If so, you should be able to create a new file in the Then select the Otherwise, this PR looks good. We will see if Travis comes back with the OK. |
Sorry if I wasn't clear — I can run the existing tests, and I know how to add new ones. I just didn't see any existing tests that tests the parameters, so I wasn't really sure how to start some from scratch (since I'm not too familiar with how the project is structured). If I have time to look into it more though, I'll look into writing same basic tests. I looked at the RouterTests again and I think I could do something similar. |
Ah okay. There have been basically no tests written yet, so lots to do... The I would include the test for this PR in the If you want to add additional tests for other aspects of Vapor (which would be greatly appreciated), you could submit that as a separate PR. |
Fixes issue #32. |
Working on tests right now, how would I go about updating this PR? My GitHub fu is lacking. |
Any commits you make to the branch involved in this PR ( |
Alrighty! Added a test if you wanna take a look, assuming travis is happy of course. |
|
||
let percentEncodedString = "testing%20parameter%21%23%24%26%27%28%29%2A%2B%2C%2F%3A%3B%3D%3F%40%5B%5D" | ||
let decodedString = percentEncodedString.stringByRemovingPercentEncoding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve the test, you could consider writing the decoded string manually. This way if stringByRemovingPercentEncoding
fails (which it could since I think it's included in the Swift linux fixes) we will know.
Will do! Wasn't sure about that, I'm still new to writing unit tests 👍 |
I realized that the test can still pass if the handler doesn't run (if someone modified the test and the handler never got called for some reason). I added in an assertion to make sure the handler was run — is there a better way to do that, or is it a good check? |
Everything looks great. Thank you! |
Decode percent encoded strings in parameters
I've updated tag |
This is a simple PR that decodes strings using
stringByRemovingPercentEncoding
before inserting them into parameters. Almost every web server does this automatically.I was unsure of what to do with regards to tests, as I didn't see existing tests for the parameters. If I could get feedback on that, I would love to write tests if needed.