Added request and response
This commit is contained in:
parent
2eff3f64c5
commit
1e79269132
4 changed files with 109 additions and 5 deletions
24
Response.go
Normal file
24
Response.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue