Skip to content

Commit

Permalink
chore: use appropriate HTTP response code for PUT in ipswd `/syms/r…
Browse files Browse the repository at this point in the history
…escan`
  • Loading branch information
blacktop committed Oct 2, 2024
1 parent 99b1e5c commit 8ff0307
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/server/routes/syms/syms.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
//
Expand Down

0 comments on commit 8ff0307

Please sign in to comment.