Bläddra i källkod

put、patch as http.StatusCreated

Paul 6 år sedan
förälder
incheckning
ffa41b82df
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2
    2
      request/request.go

+ 2
- 2
request/request.go Visa fil

@@ -55,9 +55,9 @@ func Success(ctx *gin.Context, data interface{}) {
55 55
 	}
56 56
 
57 57
 	switch ctx.Request.Method {
58
-	case http.MethodGet, http.MethodPut, http.MethodDelete, http.MethodHead, http.MethodPatch, http.MethodOptions:
58
+	case http.MethodGet, http.MethodHead, http.MethodOptions:
59 59
 		ctx.JSON(http.StatusOK, data)
60
-	case http.MethodPost:
60
+	case http.MethodPost, http.MethodPut, http.MethodPatch:
61 61
 		ctx.JSON(http.StatusCreated, data)
62 62
 	default:
63 63
 		ctx.JSON(http.StatusBadRequest, HTTPError{Msg: fmt.Sprintf("unsupported request method %s", ctx.Request.Method)})