Skip to content

url with trailingslash /user/100/ match Path: "/user/:id" shoud return 404  #8

Description

@tablecell
package main

import (
	"github.com/zpatrick/fireball"
	"net/http"
)

func index(c *fireball.Context) (fireball.Response, error) {
	return fireball.NewResponse(200, []byte("Hello, World!"), nil), nil
}

func main() {
	indexRoute := &fireball.Route{
		Path: "/user/:id",
		Handlers: fireball.Handlers{
			"GET": index,
		},
	}

	routes := []*fireball.Route{indexRoute}
	app := fireball.NewApp(routes)
	http.ListenAndServe(":8000", app)
}

$ curl http://localhost:8000/user/100/
Hello, World!

package main
import (
    "fmt"
    "net/http"
)
func main() {
    http.HandleFunc("/user/100", func (w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Welcome to my website!")
    })
   http.ListenAndServe(":80", nil)
}

$ curl http://localhost:80/user/100/
404 page not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions