Skip to content

Commit

Permalink
Gop_Env
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Mar 9, 2024
1 parent feb27fd commit ef8cb0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions classfile_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Handler struct {
Context
}

// Main is required by Go+ compiler as the entry of a YAP HTTP handler.
func (p *Handler) Main(ctx *Context) {
p.Context = *ctx
}
Expand Down
8 changes: 8 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ func (p *Context) setParam(name, val string) {
p.Form.Set(name, val)
}

// Gop_Env returns the value associated with the name.
// If the name exists in URL query, it returns the first value for the name.
func (p *Context) Gop_Env(name string) string {
return p.Param(name)
}

// Param returns the value associated with the name.
// If the name exists in URL query, it returns the first value for the name.
func (p *Context) Param(name string) string {
return p.FormValue(name)
}
Expand Down

0 comments on commit ef8cb0d

Please sign in to comment.