mirror of
https://github.com/labstack/echo.git
synced 2025-01-12 01:22:21 +02:00
Improved docs & refactored errors
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
064466bcde
commit
948198e624
@ -43,7 +43,7 @@ func (c *Context) Bind(v interface{}) error {
|
|||||||
// response with status code.
|
// response with status code.
|
||||||
func (c *Context) Render(code int, name string, data interface{}) error {
|
func (c *Context) Render(code int, name string, data interface{}) error {
|
||||||
if c.echo.renderer == nil {
|
if c.echo.renderer == nil {
|
||||||
return ErrNoRenderer
|
return RendererNotRegistered
|
||||||
}
|
}
|
||||||
c.Response.Header().Set(HeaderContentType, MIMEHTML+"; charset=utf-8")
|
c.Response.Header().Set(HeaderContentType, MIMEHTML+"; charset=utf-8")
|
||||||
c.Response.WriteHeader(code)
|
c.Response.WriteHeader(code)
|
||||||
|
6
echo.go
6
echo.go
@ -81,8 +81,8 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
ErrUnsupportedMediaType = errors.New("echo: unsupported media type")
|
UnsupportedMediaType = errors.New("echo: unsupported media type")
|
||||||
ErrNoRenderer = errors.New("echo: renderer not registered")
|
RendererNotRegistered = errors.New("echo: renderer not registered")
|
||||||
)
|
)
|
||||||
|
|
||||||
// New creates an Echo instance.
|
// New creates an Echo instance.
|
||||||
@ -119,7 +119,7 @@ func New() (e *Echo) {
|
|||||||
} else if strings.HasPrefix(ct, MIMEForm) {
|
} else if strings.HasPrefix(ct, MIMEForm) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return ErrUnsupportedMediaType
|
return UnsupportedMediaType
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -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.
|
Echo is a fast HTTP router (zero memory allocation) and micro web framework in Go.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@ -151,6 +158,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
- Find bugs
|
||||||
|
- Suggest new features
|
||||||
|
- Improve documentation
|
||||||
|
- Participate in discussion
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](https://github.com/labstack/echo/blob/master/LICENSE)
|
[MIT](https://github.com/labstack/echo/blob/master/LICENSE)
|
||||||
|
Loading…
Reference in New Issue
Block a user