mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-08-05 02:08:38 +02:00
add path param lure customization
Signed-off-by: RonniSkansing <rskansing@gmail.com>
This commit is contained in:
@@ -42,6 +42,7 @@ type JSONResponseHandler interface {
|
||||
Forbidden(g *gin.Context)
|
||||
BadRequest(g *gin.Context)
|
||||
BadRequestMessage(g *gin.Context, message string)
|
||||
Conflict(g *gin.Context, message string, data any)
|
||||
ValidationFailed(g *gin.Context, field string, err error)
|
||||
ServerError(g *gin.Context)
|
||||
ServerErrorMessage(g *gin.Context, message string)
|
||||
@@ -130,6 +131,17 @@ func (r *jsonResponseHandler) BadRequestMessage(g *gin.Context, message string)
|
||||
g.Abort()
|
||||
}
|
||||
|
||||
// Conflict responds with 409 - CONFLICT and carries enough detail for the
|
||||
// caller to offer a resolution, such as naming the campaign already holding a
|
||||
// lure code the operator asked for.
|
||||
func (r *jsonResponseHandler) Conflict(g *gin.Context, message string, data any) {
|
||||
g.JSON(
|
||||
http.StatusConflict,
|
||||
r.newResponse(false, data, message),
|
||||
)
|
||||
g.Abort()
|
||||
}
|
||||
|
||||
func (r *jsonResponseHandler) unwrapErrorMessage(err error) string {
|
||||
message := err.Error()
|
||||
unwrapped := errors.Unwrap(err)
|
||||
|
||||
Reference in New Issue
Block a user