Removed SetStatus

This commit is contained in:
Eduard Urbach 2023-07-22 14:14:50 +02:00
parent 63ee1655fe
commit 37d174eec3
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -18,7 +18,6 @@ type Context interface {
Reader(io.Reader) error Reader(io.Reader) error
Request() Request Request() Request
Response() Response Response() Response
SetStatus(status int)
String(string) error String(string) error
} }
@ -59,7 +58,7 @@ func (ctx *context) Error(status int, messages ...any) error {
} }
} }
ctx.SetStatus(status) ctx.response.WriteHeader(status)
return errors.Join(combined...) return errors.Join(combined...)
} }
@ -90,11 +89,6 @@ func (ctx *context) Response() Response {
return &ctx.response return &ctx.response
} }
// SetStatus writes the header with the given HTTP status code.
func (ctx *context) SetStatus(status int) {
ctx.response.WriteHeader(status)
}
// String responds with the given string. // String responds with the given string.
func (ctx *context) String(body string) error { func (ctx *context) String(body string) error {
slice := unsafe.Slice(unsafe.StringData(body), len(body)) slice := unsafe.Slice(unsafe.StringData(body), len(body))