mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 06:16:58 +00:00
more string
This commit is contained in:
parent
32431b23bb
commit
662d76386c
5 changed files with 51 additions and 30 deletions
|
@ -10,6 +10,13 @@ type Context struct {
|
|||
Req *http.Request
|
||||
}
|
||||
|
||||
func New(w http.ResponseWriter, r *http.Request) *Context {
|
||||
return &Context{
|
||||
RespWriter: w,
|
||||
Req: r,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Context) Context() stdContext.Context {
|
||||
if c.Req != nil {
|
||||
return c.Req.Context()
|
||||
|
@ -27,3 +34,10 @@ func (c *Context) Response() *http.Response {
|
|||
func (c *Context) Redirect(uri string, statusCode int) {
|
||||
http.Redirect(c.RespWriter, c.Req, uri, statusCode)
|
||||
}
|
||||
|
||||
// Path returns requested path.
|
||||
//
|
||||
// The returned bytes are valid until your request handler returns.
|
||||
func (c *Context) Path() string {
|
||||
return c.Req.URL.Path
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue