Test: remote handler get & request chan operations / Modify: GET request to remote server should return error http status code

This commit is contained in:
HFO4
2020-01-04 15:17:27 +08:00
parent aeca161186
commit 93dc25aabb
10 changed files with 249 additions and 44 deletions

View File

@@ -81,7 +81,7 @@ func SlaveUpload(c *gin.Context) {
})
}
// SlaveDownload 从机文件下载
// SlaveDownload 从机文件下载,此请求返回的HTTP状态码不全为200
func SlaveDownload(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
@@ -91,10 +91,10 @@ func SlaveDownload(c *gin.Context) {
if err := c.ShouldBindUri(&service); err == nil {
res := service.ServeFile(ctx, c, true)
if res.Code != 0 {
c.JSON(200, res)
c.JSON(400, res)
}
} else {
c.JSON(200, ErrorResponse(err))
c.JSON(400, ErrorResponse(err))
}
}