1
This commit is contained in:
parent
7442ad5d81
commit
933ed5c972
15
sysutils.go
15
sysutils.go
@ -5,6 +5,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
"io/ioutil"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,14 +37,20 @@ func Request(r *http.Request, name string) *XValue {
|
|||||||
if r.Form == nil {
|
if r.Form == nil {
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
}
|
}
|
||||||
v := &XValue{}
|
|
||||||
if vs, ok := r.Form[name]; ok {
|
if vs, ok := r.Form[name]; ok {
|
||||||
if len(vs) > 0 {
|
if len(vs) > 0 {
|
||||||
v.SetString(vs[0])
|
return NewXString(vs[0])
|
||||||
} else {
|
|
||||||
v.SetString("")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return NewXString("")
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPostBody(r *http.Request) *XValue {
|
||||||
|
body, err := ioutil.ReadAll(r.Body)
|
||||||
|
if err != nil {
|
||||||
|
return NewXString("")
|
||||||
|
}
|
||||||
|
v := NewXString(string(body))
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user