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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for client request with and without trailing slash. #522

Merged
merged 2 commits into from
Feb 28, 2023

Conversation

Gerrit91
Copy link
Contributor

@Gerrit91 Gerrit91 commented Feb 27, 2023

With #520 clients receive different responses depending on a trailing slash in the requested path. This did not matter before, so this was a breaking change.

I wrote a small reproducer test to show the difference before and after 05c4911.

Is this expected behavior? It breaks quite a lot of our stuff. 馃檲

@Gerrit91
Copy link
Contributor Author

Gerrit91 commented Feb 27, 2023

More precisely, the behavior toggled, so before #520 the trailing slash was matching, now the non-trailing slash is matching. Hope the test can point out the difference.

@emicklei
Copy link
Owner

thank you for sharing your thoughts and providing a test.

Given the number of reports of problems after fixing a security issue; i am now strongly considering making the "trailing slash handling" a configuration option. The old behavior being the default with the option to change the behaviour to meet the security request.

@emicklei emicklei merged commit daf9981 into emicklei:v3 Feb 28, 2023
@Gerrit91 Gerrit91 deleted the trailing-slash branch February 28, 2023 08:25
@Gerrit91
Copy link
Contributor Author

Thanks @emicklei. I am looking forward to whatever route this problem will take and wait with the update until a decision was made. The config option sounds like a reasonable way to go in order to maintain client compatibility.

emicklei added a commit that referenced this pull request Aug 5, 2023
* allow multiple samples for Write, issue #514

* update changelog

* chore: example handling request parameters with httpin (#518)

* use path package to join slash fragments #519 (#520)

* update hist

* update example openapi to use 3.10.1

* Add test for client request with and without trailing slash. (#522)

* Add test for client request with and without trailing slash.

* Correction.

* introduce MergePathStrategy

* Revert "introduce MergePathStrategy"

This reverts commit 709cf80.

* introduce MergePathStrategy for #521 #519 (#523)

* introduce MergePathStrategy for #521 #519

* update readme, set default to new strategy, add extra test

* link to security issue

* update change hist

* add hello world with TrimSlashStrategy

* two route example

* examples to show differences #519

* more route examples #519

* add examples for issue519 with path in root

* remove obsolete swagger example

* Update README.md

remover swagger12 mention

* allow multiple samples for Write, issue #514

---------

Co-authored-by: Ggicci <ggicci.t@gmail.com>
Co-authored-by: Gerrit <Gerrit91@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

2 participants