()
| 110 | } |
| 111 | |
| 112 | func (h *Handler) OpenFile() iris.Handler { |
| 113 | return func(ctx *context.Context) { |
| 114 | var req fileModel.Request |
| 115 | if err := ctx.ReadJSON(&req); err != nil { |
| 116 | ctx.StatusCode(iris.StatusBadRequest) |
| 117 | ctx.Values().Set("message", err.Error()) |
| 118 | return |
| 119 | } |
| 120 | withRequestUser(ctx, &req) |
| 121 | res, err := h.fileService.CatFile(req) |
| 122 | if err != nil { |
| 123 | ctx.StatusCode(iris.StatusInternalServerError) |
| 124 | ctx.Values().Set("message", err.Error()) |
| 125 | return |
| 126 | } |
| 127 | ctx.Values().Set("data", string(res)) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | func (h *Handler) ReNameFile() iris.Handler { |
| 132 | return func(ctx *context.Context) { |
no test coverage detected