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

v3: Fix trailing slash in routing removed #2530

Merged
merged 3 commits into from
Apr 13, 2020

Conversation

ikawaha
Copy link
Contributor

@ikawaha ikawaha commented Apr 13, 2020

The routing trailing slash problem fixed in v1 seems to be occurring again in v3.
This patch fixes it in the same way as v1.

see also. #1283

@ikawaha ikawaha changed the title Fix trailing slash in routing removed v3: Fix trailing slash in routing removed Apr 13, 2020
@ikawaha ikawaha closed this Apr 13, 2020
@ikawaha ikawaha changed the title v3: Fix trailing slash in routing removed [WIP] v3: Fix trailing slash in routing removed Apr 13, 2020
@ikawaha ikawaha reopened this Apr 13, 2020
@ikawaha ikawaha changed the title [WIP] v3: Fix trailing slash in routing removed v3: Fix trailing slash in routing removed Apr 13, 2020
@raphael
Copy link
Member

raphael commented Apr 13, 2020

Great, thank you! Can you please also back-port to v2, thanks!

@raphael raphael merged commit 4064ab2 into goadesign:v3 Apr 13, 2020
ikawaha added a commit to ikawaha/goa that referenced this pull request Apr 13, 2020
* Fix trailing slash in routing removed

* Exclude when the path is the root

* Fix a test
@ikawaha ikawaha deleted the fix/v3/trailing-slash branch April 14, 2020 08:50
raphael pushed a commit that referenced this pull request Apr 14, 2020
* v3: Fix trailing slash in routing removed (#2530)

* Fix trailing slash in routing removed

* Exclude when the path is the root

* Fix a test

* Fix import paths
@trestletech
Copy link

Is the handling here different for POST requests? I'm seeing

My design is:

		HTTP(func() {
			POST("/blah/")
			Response(StatusOK)
		})

but I'm seeing:

[srvrapi] 21:50:27 id=oEcoo0o3 req=POST /blah/ from=172.17.0.1
[srvrapi] 21:50:27 id=oEcoo0o3 status=301 bytes=0 time=143.6µs
[srvrapi] 21:50:27 id=SUOWXrMt req=GET /blah from=172.17.0.1
[srvrapi] 21:50:27 id=SUOWXrMt status=405 bytes=0 time=68.5µs

(where the 405 indicates that the GET call to that path is invalid). I tried updating to the latest commit using go get -u goa.design/goa/v3@4064ab219b39e4741ec61a06f62b6ba5906ffae0 but still see this behavior.

@trestletech
Copy link

Just confirmed that if I add the trailing slash back into mux.Handle("POST", "/learnr", f) in the generated server.go, it starts working for me.

Did I fail to update to the right version, or is this bug still open for POST requests?

@trestletech
Copy link

Oops. I think I was forgetting to rerun generate. Once I did that, I think we're back online. Thanks for the fix and sorry for the false alarm!

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.

3 participants