Skip to content

Commit

Permalink
used gofiber for application/problem+json responses
Browse files Browse the repository at this point in the history
  • Loading branch information
richardrdev committed Feb 23, 2024
1 parent 85b047e commit 3bc8718
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ func CustomErrorHandler(ctx *fiber.Ctx, err error) error {
}
}

err = ctx.Status(problemJSON.Status).JSON(problemJSON)
ctx.Status(problemJSON.Status)

// Needs to be after the call to JSON(), to override the
// automatic Content-Type
ctx.Set(fiber.HeaderContentType, "application/problem+json")

return err
return ctx.JSON(fiber.Map{
"title": problemJSON.Title,
"detail": problemJSON.Detail,
"status": problemJSON.Status,
}, "application/problem+json")
}

0 comments on commit 3bc8718

Please sign in to comment.