Implemented the io.Writer interface
This commit is contained in:
@ -26,6 +26,7 @@ type Context interface {
|
||||
ResponseHeader(key string) string
|
||||
Status(status int) Context
|
||||
String(string) error
|
||||
Write([]byte) (int, error)
|
||||
}
|
||||
|
||||
// ctx represents a request & response context.
|
||||
@ -142,6 +143,11 @@ func (ctx *ctx) String(body string) error {
|
||||
return ctx.Bytes(slice)
|
||||
}
|
||||
|
||||
// Write implements the io.Writer interface.
|
||||
func (ctx *ctx) Write(body []byte) (int, error) {
|
||||
return ctx.response.Write(body)
|
||||
}
|
||||
|
||||
// addParameter adds a new parameter to the context.
|
||||
func (ctx *ctx) addParameter(name string, value string) {
|
||||
ctx.paramNames[ctx.paramCount] = name
|
||||
|
Reference in New Issue
Block a user