This commit is contained in:
1-6
2023-07-12 15:41:07 +08:00
parent 396231f528
commit d0716ea1bd
11 changed files with 89 additions and 42 deletions
+5 -2
View File
@@ -39,10 +39,13 @@ type Request struct {
Mark interface{}
}
func (r *Request) Body() string {
func (r *Request) Body(tp string) interface{} {
if len(r.bodyData) == 0 {
r.bodyData, _ = ioutil.ReadAll(r.c.Request.Body)
}
if tp == "bytes" {
return r.bodyData
}
return string(r.bodyData)
}
@@ -146,7 +149,7 @@ func (r *Request) SetSession(k, v string) string {
json.Unmarshal(web_sessions.GetBytes(r.uuid), &j)
j[k] = v
j["time"] = time.Now().Unix()
_, err := web_sessions.Set(r.uuid, utils.JsonMarshal(j))
_, _, err := web_sessions.Set(r.uuid, utils.JsonMarshal(j))
if err != nil {
return err.Error()
}