Change Bytes method to BodyBytes
This commit is contained in:
parent
bba773432b
commit
91be16c3a4
@ -15,7 +15,7 @@ type PrototypeRequestBuilder interface {
|
|||||||
|
|
||||||
type Response interface {
|
type Response interface {
|
||||||
Header() (header Header)
|
Header() (header Header)
|
||||||
Bytes() (body []byte)
|
BodyBytes() (body []byte)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrototypeResponse interface {
|
type PrototypeResponse interface {
|
||||||
@ -25,7 +25,7 @@ type PrototypeResponse interface {
|
|||||||
type ErrorResponse interface {
|
type ErrorResponse interface {
|
||||||
Ok() (ok bool)
|
Ok() (ok bool)
|
||||||
HttpStatus() (code int)
|
HttpStatus() (code int)
|
||||||
Bytes() (body []byte)
|
BodyBytes() (body []byte)
|
||||||
String() (out string)
|
String() (out string)
|
||||||
Error() (out string)
|
Error() (out string)
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ func (srv *server) PostServeFunc(serve ServeFunc) *server {
|
|||||||
func (srv *server) handleError(errRes ErrorResponse, w http.ResponseWriter) (ok bool) {
|
func (srv *server) handleError(errRes ErrorResponse, w http.ResponseWriter) (ok bool) {
|
||||||
if !errRes.Ok() {
|
if !errRes.Ok() {
|
||||||
w.WriteHeader(errRes.HttpStatus())
|
w.WriteHeader(errRes.HttpStatus())
|
||||||
w.Write(errRes.Bytes())
|
w.Write(errRes.BodyBytes())
|
||||||
srv.logger.Logf(log.LevelError, errRes.String())
|
srv.logger.Logf(log.LevelError, errRes.String())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -95,5 +95,5 @@ func (srv *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(res.Bytes())
|
w.Write(res.BodyBytes())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user