This commit is contained in:
6543 2022-11-11 05:21:05 +01:00
parent 7f2854d537
commit 05e075dd83
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862
5 changed files with 25 additions and 23 deletions

View file

@ -10,6 +10,7 @@ import (
type Context struct {
RespWriter http.ResponseWriter
Req *http.Request
StatusCode int
}
func New(w http.ResponseWriter, r *http.Request) *Context {
@ -27,10 +28,7 @@ func (c *Context) Context() stdContext.Context {
}
func (c *Context) Response() *http.Response {
if c.Req != nil {
if c.Req.Response == nil {
c.Req.Response = &http.Response{Header: make(http.Header)}
}
if c.Req != nil && c.Req.Response != nil {
return c.Req.Response
}
return nil