Finish the PUT method of webdav.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user