Finish the PUT method of webdav.

This commit is contained in:
zicla
2019-04-22 00:40:31 +08:00
parent ee9b049db4
commit 8632d7686b
5 changed files with 50 additions and 14 deletions

View File

@ -2,7 +2,6 @@ package rest
import (
"fmt"
"io/ioutil"
"net/http"
"regexp"
)
@ -139,11 +138,7 @@ func (this *DavController) Index(writer http.ResponseWriter, request *http.Reque
}
fmt.Printf("\n------Body------\n")
body, err := ioutil.ReadAll(request.Body)
if err != nil {
fmt.Println("读取body时出错" + err.Error())
}
fmt.Println(string(body))
//ioutil.ReadAll 不可重复读,第二次读的时候就什么都没有了。
fmt.Println("------------------")
@ -152,6 +147,7 @@ func (this *DavController) Index(writer http.ResponseWriter, request *http.Reque
method := request.Method
if method == "PROPFIND" {
//列出文件夹或者目录详情
this.davService.HandlePropfind(writer, request, user, subPath)
@ -159,6 +155,10 @@ func (this *DavController) Index(writer http.ResponseWriter, request *http.Reque
//请求文件详情(下载)
this.davService.HandleGet(writer, request, user, subPath)
} else if method == "PUT" {
//上传文件
this.davService.HandlePut(writer, request, user, subPath)
} else if method == "DELETE" {
//删除文件
this.davService.HandleDelete(writer, request, user, subPath)