"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "routes_test.go" between
gin-1.7.6.tar.gz and gin-1.7.7.tar.gz

About: Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API (with much better performance).

routes_test.go  (gin-1.7.6):routes_test.go  (gin-1.7.7)
skipping to change at line 482 skipping to change at line 482
router.PATCH("/path", func(c *Context) {}) router.PATCH("/path", func(c *Context) {})
w = performRequest(router, http.MethodPatch, "/path/") w = performRequest(router, http.MethodPatch, "/path/")
assert.Equal(t, http.StatusTemporaryRedirect, w.Code) assert.Equal(t, http.StatusTemporaryRedirect, w.Code)
assert.Equal(t, "map[Location:[/path]]", fmt.Sprint(w.Header())) assert.Equal(t, "map[Location:[/path]]", fmt.Sprint(w.Header()))
// Test special case where no node for the prefix "/" exists // Test special case where no node for the prefix "/" exists
router = New() router = New()
router.GET("/a", func(c *Context) {}) router.GET("/a", func(c *Context) {})
w = performRequest(router, http.MethodGet, "/") w = performRequest(router, http.MethodGet, "/")
assert.Equal(t, http.StatusNotFound, w.Code) assert.Equal(t, http.StatusNotFound, w.Code)
// Reproduction test for the bug of issue #2843
router = New()
router.NoRoute(func(c *Context) {
if c.Request.RequestURI == "/login" {
c.String(200, "login")
}
})
router.GET("/logout", func(c *Context) {
c.String(200, "logout")
})
w = performRequest(router, http.MethodGet, "/login")
assert.Equal(t, "login", w.Body.String())
w = performRequest(router, http.MethodGet, "/logout")
assert.Equal(t, "logout", w.Body.String())
} }
func TestRouterStaticFSNotFound(t *testing.T) { func TestRouterStaticFSNotFound(t *testing.T) {
router := New() router := New()
router.StaticFS("/", http.FileSystem(http.Dir("/thisreallydoesntexist/")) ) router.StaticFS("/", http.FileSystem(http.Dir("/thisreallydoesntexist/")) )
router.NoRoute(func(c *Context) { router.NoRoute(func(c *Context) {
c.String(404, "non existent") c.String(404, "non existent")
}) })
w := performRequest(router, http.MethodGet, "/nonexistent") w := performRequest(router, http.MethodGet, "/nonexistent")
 End of changes. 1 change blocks. 
0 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)