mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-30 18:13:36 +02:00
25 lines
383 B
Go
25 lines
383 B
Go
package context
|
|
|
|
import (
|
|
stdContext "context"
|
|
"net/http"
|
|
)
|
|
|
|
type Context struct {
|
|
RespWriter http.ResponseWriter
|
|
Req *http.Request
|
|
}
|
|
|
|
func (c *Context) Context() stdContext.Context {
|
|
if c.Req != nil {
|
|
return c.Req.Context()
|
|
}
|
|
return stdContext.Background()
|
|
}
|
|
|
|
func (c *Context) Response() *http.Response {
|
|
if c.Req != nil {
|
|
return c.Req.Response
|
|
}
|
|
return nil
|
|
}
|