From 8ff0307cf5bd170a07b680e4c036552c1fe45995 Mon Sep 17 00:00:00 2001 From: blacktop Date: Wed, 2 Oct 2024 12:09:05 -0600 Subject: [PATCH] chore: use appropriate HTTP response code for PUT in `ipswd` `/syms/rescan` --- api/server/routes/syms/syms.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/server/routes/syms/syms.go b/api/server/routes/syms/syms.go index 2240e0a05..8a2c193ad 100644 --- a/api/server/routes/syms/syms.go +++ b/api/server/routes/syms/syms.go @@ -20,6 +20,11 @@ type successResponse struct { Success bool `json:"success,omitempty"` } +// swagger:response +type createdResponse struct { + Created bool `json:"created,omitempty"` +} + // swagger:response type symIpswResponse *model.Ipsw @@ -132,7 +137,7 @@ func AddRoutes(rg *gin.RouterGroup, db db.Database, pemDB, sigsDir string) { // required: false // type: string // Responses: - // 200: successResponse + // 201: createdResponse // 500: genericError rg.PUT("/syms/rescan", func(c *gin.Context) { ipswPath, ok := c.GetQuery("path") @@ -162,7 +167,7 @@ func AddRoutes(rg *gin.RouterGroup, db db.Database, pemDB, sigsDir string) { c.AbortWithStatusJSON(http.StatusInternalServerError, types.GenericError{Error: err.Error()}) return } - c.JSON(http.StatusOK, successResponse{Success: true}) + c.JSON(http.StatusCreated, createdResponse{Created: true}) }) // swagger:route GET /syms/ipsw Syms getIPSW //