Skip to content

Commit bd0c177

Browse files
committed
Updated docs
Signed-off-by: Vishal Rana <[email protected]>
1 parent f80fff4 commit bd0c177

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

website/docs/guide.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ below registers a route for method `GET`, path `/hello` and a handler which send
6363
`Hello!` response.
6464

6565
```go
66-
echo.Get("/hello", func(*echo.Context) {
67-
c.String(http.StatusOK, "Hello!")
66+
echo.Get("/hello", func(*echo.Context) *HTTPError {
67+
return c.String(http.StatusOK, "Hello!")
6868
})
6969
```
7070

@@ -83,14 +83,14 @@ index `echo.Context.P(i uint8) string`. Getting parameter by index gives a sligh
8383
better performance.
8484

8585
```go
86-
echo.Get("/users/:id", func(c *echo.Context) {
86+
echo.Get("/users/:id", func(c *echo.Context) *HTTPError {
8787
// By name
8888
id := c.Param("id")
8989

9090
// By index
9191
id := c.P(0)
9292

93-
c.String(http.StatusOK, id)
93+
return c.String(http.StatusOK, id)
9494
})
9595
```
9696

@@ -113,16 +113,16 @@ match
113113
#### Example
114114

115115
```go
116-
e.Get("/users/:id", func(c *echo.Context) {
117-
c.String(http.StatusOK, "/users/:id")
116+
e.Get("/users/:id", func(c *echo.Context) *HTTPError {
117+
return c.String(http.StatusOK, "/users/:id")
118118
})
119119

120-
e.Get("/users/new", func(c *echo.Context) {
121-
c.String(http.StatusOK, "/users/new")
120+
e.Get("/users/new", func(c *echo.Context) *HTTPError {
121+
return c.String(http.StatusOK, "/users/new")
122122
})
123123

124-
e.Get("/users/1/files/*", func(c *echo.Context) {
125-
c.String(http.StatusOK, "/users/1/files/*")
124+
e.Get("/users/1/files/*", func(c *echo.Context) *HTTPError {
125+
return c.String(http.StatusOK, "/users/1/files/*")
126126
})
127127
```
128128

@@ -146,8 +146,8 @@ application.
146146

147147
```go
148148
// Handler
149-
h := func(*echo.Context) {
150-
c.String(http.StatusOK, "OK")
149+
h := func(*echo.Context) *HTTPError {
150+
return c.String(http.StatusOK, "OK")
151151
}
152152

153153
// Route
@@ -161,23 +161,23 @@ e.Get("/users/:id", h)
161161
### JSON
162162

163163
```go
164-
context.JSON(code int, v interface{}) error
164+
context.JSON(code int, v interface{}) *HTTPError
165165
```
166166

167167
Sends a JSON response with status code.
168168

169169
### String
170170

171171
```go
172-
context.String(code int, s string) error
172+
context.String(code int, s string) *HTTPError
173173
```
174174

175175
Sends a text/plain response with status code.
176176

177177
### HTML
178178

179179
```go
180-
func (c *Context) HTML(code int, html string) error
180+
func (c *Context) HTML(code int, html string) *HTTPError
181181
```
182182

183183
Sends an HTML response with status code.

0 commit comments

Comments
 (0)