Add the quota method.

This commit is contained in:
zicla
2019-04-22 01:19:34 +08:00
parent 8632d7686b
commit f0be23879d
3 changed files with 50 additions and 14 deletions

View File

@ -1,7 +1,9 @@
package rest
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"regexp"
)
@ -140,6 +142,19 @@ func (this *DavController) Index(writer http.ResponseWriter, request *http.Reque
fmt.Printf("\n------Body------\n")
//ioutil.ReadAll 不可重复读,第二次读的时候就什么都没有了。
bodyBytes, err := ioutil.ReadAll(request.Body)
if err != nil {
fmt.Println("读取body时出错" + err.Error())
}
fmt.Println(string(bodyBytes))
//关闭之后再重新赋值
err = request.Body.Close()
if err != nil {
panic(err)
}
request.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
fmt.Println("------------------")
//获取请求者