Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@arp242
Copy link
Contributor

@arp242 arp242 commented Apr 10, 2018

This is a follow-up to #1101. It turns out that that patch is
incomplete, as a similar check also needs to be added in the
Router.Add() method.

I don't understand why the test works fine, but when using it in a real
application. For example with this example:

func main() {
	e := echo.New()
	e.GET("/xxx/:id.json", func(c echo.Context) error {
		return c.String(200, fmt.Sprintf("%#v: names: %#v; vals: %#v",
			c.Path(), c.ParamNames(), c.ParamValues()))
	})
	log.Fatal(e.Start(":8000"))
}

Gives a 404 on /xxx/42.json, and for /xxx/42 it gives the output:

/xxx/:id.json": names: []string{"id.json"}; vals: []string{"42"}

It makes sense to add the test there too; I just don't get why the test
cases that I added in ##1101 does produce the correct output :-/

This is a follow-up to #1101. It turns out that that patch is
incomplete, as a similar check also needs to be added in the
`Router.Add()` method.

I don't understand why the test works fine, but when using it in a real
application. For example with this example:

	func main() {
		e := echo.New()
		e.GET("/xxx/:id.json", func(c echo.Context) error {
			return c.String(200, fmt.Sprintf("%#v: names: %#v; vals: %#v",
				c.Path(), c.ParamNames(), c.ParamValues()))
		})
		log.Fatal(e.Start(":8000"))
	}

Gives a 404 on `/xxx/42.json`, and for `/xxx/42` it gives the output:

	/xxx/:id.json": names: []string{"id.json"}; vals: []string{"42"}

It makes sense to add the test there too; I just don't get why the test
cases that I added in ##1101 *does* produce the correct output :-/
@codecov
Copy link

codecov bot commented Apr 10, 2018

Codecov Report

Merging #1106 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1106   +/-   ##
=======================================
  Coverage   81.14%   81.14%           
=======================================
  Files          25       25           
  Lines        1899     1899           
=======================================
  Hits         1541     1541           
  Misses        250      250           
  Partials      108      108
Impacted Files Coverage Δ
router.go 93.3% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b769f9...67f47d1. Read the comment docs.

@vishr vishr self-requested a review April 10, 2018 21:53
@vishr vishr merged commit cf7b555 into labstack:master Apr 10, 2018
@arp242 arp242 deleted the fix-add branch April 10, 2018 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.