Skip to content

Commit 1559ea5

Browse files
authored
Merge pull request #98 from xushiwei/q
Gop_Env
2 parents 66e0e28 + ef8cb0d commit 1559ea5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

classfile_v2.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Handler struct {
2525
Context
2626
}
2727

28+
// Main is required by Go+ compiler as the entry of a YAP HTTP handler.
2829
func (p *Handler) Main(ctx *Context) {
2930
p.Context = *ctx
3031
}

context.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ func (p *Context) setParam(name, val string) {
3737
p.Form.Set(name, val)
3838
}
3939

40+
// Gop_Env returns the value associated with the name.
41+
// If the name exists in URL query, it returns the first value for the name.
42+
func (p *Context) Gop_Env(name string) string {
43+
return p.Param(name)
44+
}
45+
46+
// Param returns the value associated with the name.
47+
// If the name exists in URL query, it returns the first value for the name.
4048
func (p *Context) Param(name string) string {
4149
return p.FormValue(name)
4250
}

0 commit comments

Comments
 (0)