Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
Vishal Rana committed Apr 13, 2016
1 parent b9aa218 commit 909f6da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# [Echo](http://labstack.com/echo) [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/echo) [![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/labstack/echo/master/LICENSE) [![Build Status](http://img.shields.io/travis/labstack/echo.svg?style=flat-square)](https://travis-ci.org/labstack/echo) [![Coverage Status](http://img.shields.io/coveralls/labstack/echo.svg?style=flat-square)](https://coveralls.io/r/labstack/echo) [![Join the chat at https://gitter.im/labstack/echo](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg?style=flat-square)](https://gitter.im/labstack/echo)

#### Echo is a fast and unfancy web framework for Go (Golang). Up to 10x faster than the rest.
#### Echo is a fast and unfancy HTTP server framework for Go (Golang). Up to 10x faster than the rest.

## Features

Expand Down
2 changes: 1 addition & 1 deletion echo.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Package echo implements a fast and unfancy web framework for Go (Golang).
Package echo implements a fast and unfancy HTTP server framework for Go (Golang).
Example:
Expand Down
12 changes: 10 additions & 2 deletions middleware/slash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ func TestAddTrailingSlash(t *testing.T) {
})
h(c)
assert.Equal(t, "/add-slash/", rq.URL().Path())
assert.Equal(t, "/add-slash/", rq.URI())

// With config
rq = test.NewRequest(echo.GET, "/add-slash?key=value", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
h = AddTrailingSlashWithConfig(TrailingSlashConfig{RedirectCode: http.StatusMovedPermanently})(func(c echo.Context) error {
h = AddTrailingSlashWithConfig(TrailingSlashConfig{
RedirectCode: http.StatusMovedPermanently,
})(func(c echo.Context) error {
return nil
})
h(c)
assert.Equal(t, http.StatusMovedPermanently, rc.Status())
assert.Equal(t, "/add-slash/?key=value", rq.URI())
assert.Equal(t, "/add-slash/?key=value", rc.Header().Get(echo.HeaderLocation))
}

Expand All @@ -42,15 +46,19 @@ func TestRemoveTrailingSlash(t *testing.T) {
})
h(c)
assert.Equal(t, "/remove-slash", rq.URL().Path())
assert.Equal(t, "/remove-slash", rq.URI())

// With config
rq = test.NewRequest(echo.GET, "/remove-slash/?key=value", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
h = RemoveTrailingSlashWithConfig(TrailingSlashConfig{RedirectCode: http.StatusMovedPermanently})(func(c echo.Context) error {
h = RemoveTrailingSlashWithConfig(TrailingSlashConfig{
RedirectCode: http.StatusMovedPermanently,
})(func(c echo.Context) error {
return nil
})
h(c)
assert.Equal(t, http.StatusMovedPermanently, rc.Status())
assert.Equal(t, "/remove-slash?key=value", rq.URI())
assert.Equal(t, "/remove-slash?key=value", rc.Header().Get(echo.HeaderLocation))
}

0 comments on commit 909f6da

Please sign in to comment.