1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Improved docs & refactored errors

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-04-19 22:04:30 -07:00
parent 064466bcde
commit 948198e624
3 changed files with 18 additions and 5 deletions

View File

@ -43,7 +43,7 @@ func (c *Context) Bind(v interface{}) error {
// response with status code.
func (c *Context) Render(code int, name string, data interface{}) error {
if c.echo.renderer == nil {
return ErrNoRenderer
return RendererNotRegistered
}
c.Response.Header().Set(HeaderContentType, MIMEHTML+"; charset=utf-8")
c.Response.WriteHeader(code)

View File

@ -81,8 +81,8 @@ var (
}
// Errors
ErrUnsupportedMediaType = errors.New("echo: unsupported media type")
ErrNoRenderer = errors.New("echo: renderer not registered")
UnsupportedMediaType = errors.New("echo: unsupported media type")
RendererNotRegistered = errors.New("echo: renderer not registered")
)
// New creates an Echo instance.
@ -119,7 +119,7 @@ func New() (e *Echo) {
} else if strings.HasPrefix(ct, MIMEForm) {
return nil
}
return ErrUnsupportedMediaType
return UnsupportedMediaType
})
return

View File

@ -1,4 +1,11 @@
# Echo [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/echo) [![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)
# Echo
Simple and performant web development!
---
## Overview
Echo is a fast HTTP router (zero memory allocation) and micro web framework in Go.
## Features
@ -151,6 +158,12 @@ func main() {
}
```
## Contribute
- Find bugs
- Suggest new features
- Improve documentation
- Participate in discussion
## License
[MIT](https://github.com/labstack/echo/blob/master/LICENSE)