gofiber / fiber

⚡️ Express inspired web framework written in Go
https://gofiber.io
MIT License
33.93k stars 1.67k forks source link

🚀 [Feature]: Support for application/problem+json #2701

Closed arielsrv closed 1 year ago

arielsrv commented 1 year ago

Feature Description

Helpers should have support for application/problem+json RFC7807

const (
    MIMETextXML                = "text/xml"
    MIMETextHTML               = "text/html"
    MIMETextPlain              = "text/plain"
    MIMETextJavaScript         = "text/javascript"
    MIMEApplicationXML         = "application/xml"
    MIMEApplicationJSON        = "application/json"
        // New!
    MIMEApplicationProblemJSON = "application/problem+json" 
    // Deprecated: use MIMETextJavaScript instead
    MIMEApplicationJavaScript = "application/javascript"
    MIMEApplicationForm       = "application/x-www-form-urlencoded"
    MIMEOctetStream           = "application/octet-stream"
    MIMEMultipartForm         = "multipart/form-data"

    MIMETextXMLCharsetUTF8                = "text/xml; charset=utf-8"
    MIMETextHTMLCharsetUTF8               = "text/html; charset=utf-8"
    MIMETextPlainCharsetUTF8              = "text/plain; charset=utf-8"
    MIMETextJavaScriptCharsetUTF8         = "text/javascript; charset=utf-8"
    MIMEApplicationXMLCharsetUTF8         = "application/xml; charset=utf-8"
    MIMEApplicationJSONCharsetUTF8        = "application/json; charset=utf-8"
    // New!
        MIMEApplicationProblemJSONCharsetUTF8 = "application/problem+json; charset=utf-8"
    // Deprecated: use MIMETextJavaScriptCharsetUTF8 instead
    MIMEApplicationJavaScriptCharsetUTF8 = "application/javascript; charset=utf-8"
)

Additional Context (optional)

No response

Code Snippet (optional)

package main

import "github.com/gofiber/fiber/v2"
import "log"

func main() {
  app := fiber.New()

  // An example to describe the feature

  log.Fatal(app.Listen(":3000"))
}

Checklist:

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord