working commit
This commit is contained in:
@@ -17,3 +17,45 @@ func (hand *Handler) FileExists(rctx *router.Context) {
|
||||
code, _, _ := hand.oper.FileExists(params)
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
|
||||
func (hand *Handler) PutFile(rctx *router.Context) {
|
||||
hand.logg.Debugf("handle PutFile")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
params := &operator.PutFileParams{
|
||||
Filepath: filepath,
|
||||
Source: rctx.Request.Body,
|
||||
}
|
||||
hand.logg.Debugf("filepath: %s", filepath)
|
||||
|
||||
code, _, _ := hand.oper.PutFile(params)
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
|
||||
func (hand *Handler) GetFile(rctx *router.Context) {
|
||||
hand.logg.Debugf("handle GetFile")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
params := &operator.GetFileParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
hand.logg.Debugf("filepath: %s", filepath)
|
||||
|
||||
code, res, _ := hand.oper.GetFile(params)
|
||||
rctx.SetHeader("Content-Type", res.ContentType)
|
||||
rctx.SetHeader("Content-Length", res.ContentLength)
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
|
||||
func (hand *Handler) DeleteFile(rctx *router.Context) {
|
||||
hand.logg.Debugf("handle DeleteFile")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
params := &operator.DeleteFileParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
hand.logg.Debugf("filepath: %s", filepath)
|
||||
|
||||
code, _, _ := hand.oper.DeleteFile(params)
|
||||
rctx.SetStatus(code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user