Change Bytes method to BodyBytes

This commit is contained in:
some 2024-10-08 20:47:49 -04:00
parent bba773432b
commit 91be16c3a4
Signed by: some
GPG Key ID: 65D0589220B9BFC8
2 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ type PrototypeRequestBuilder interface {
type Response interface {
Header() (header Header)
Bytes() (body []byte)
BodyBytes() (body []byte)
}
type PrototypeResponse interface {
@ -25,7 +25,7 @@ type PrototypeResponse interface {
type ErrorResponse interface {
Ok() (ok bool)
HttpStatus() (code int)
Bytes() (body []byte)
BodyBytes() (body []byte)
String() (out string)
Error() (out string)
}

View File

@ -56,7 +56,7 @@ func (srv *server) PostServeFunc(serve ServeFunc) *server {
func (srv *server) handleError(errRes ErrorResponse, w http.ResponseWriter) (ok bool) {
if !errRes.Ok() {
w.WriteHeader(errRes.HttpStatus())
w.Write(errRes.Bytes())
w.Write(errRes.BodyBytes())
srv.logger.Logf(log.LevelError, errRes.String())
return false
}
@ -95,5 +95,5 @@ func (srv *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}
}
w.Write(res.Bytes())
w.Write(res.BodyBytes())
}