Added middleware support

This commit is contained in:
Eduard Urbach 2024-03-13 20:18:01 +01:00
parent 1e8a846457
commit 414f7c6b33
Signed by: eduard
GPG key ID: 49226B848C78F6C8
9 changed files with 135 additions and 157 deletions

View file

@ -1,24 +0,0 @@
package server
import "net/http"
// Response is the interface for an HTTP response.
type Response interface {
Header(key string) string
SetHeader(key string, value string)
}
// response represents the HTTP response used in the given context.
type response struct {
http.ResponseWriter
}
// Header returns the header value for the given key.
func (res response) Header(key string) string {
return res.ResponseWriter.Header().Get(key)
}
// SetHeader sets the header value for the given key.
func (res response) SetHeader(key string, value string) {
res.ResponseWriter.Header().Set(key, value)
}