MCPcopy Create free account
hub / github.com/astercloud/aster / Delete

Method Delete

server/handlers/middleware.go:172–187  ·  view source on GitHub ↗

Delete 删除中间件

(c *gin.Context)

Source from the content-addressed store, hash-verified

170
171// Delete 删除中间件
172func (h *MiddlewareHandler) Delete(c *gin.Context) {
173 ctx := c.Request.Context()
174 id := c.Param("id")
175
176 if err := h.store.Delete(ctx, "middlewares", id); err != nil {
177 if errors.Is(err, store.ErrNotFound) {
178 c.JSON(404, gin.H{"success": false, "error": gin.H{"code": "not_found", "message": "middleware not found"}})
179 return
180 }
181 c.JSON(500, gin.H{"success": false, "error": gin.H{"code": "internal_error", "message": err.Error()}})
182 return
183 }
184
185 logging.Info(ctx, "middleware.deleted", map[string]any{"id": id})
186 c.Status(204)
187}
188
189// Enable 启用中间件
190func (h *MiddlewareHandler) Enable(c *gin.Context) {

Callers

nothing calls this directly

Calls 6

InfoFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
DeleteMethod · 0.65
ErrorMethod · 0.65
StatusMethod · 0.45

Tested by

no test coverage detected