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