rgbrota / go-problemdetails-recoverer

ProblemDetails specification [RFC-7807] (https://www.rfc-editor.org/rfc/rfc7807) recoverer middleware in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🛡️ go-problemdetails-recoverer

License Build status Go Report Card

About

Problem details specification [RFC-7807] recoverer middleware library written in Go.

The objective of this middleware is to recover from panics gracefully and return a 500 Internal Server Error instead. The error response follows the problem details specification and looks like the following structure:

{
  "type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.6.1",
  "title": "Internal Server Error",
  "status": 500
}

For more information on how to be compliant with the specification, please see RFC-7807.

Installation

go get github.com/rgbrota/go-problemdetails-recoverer

Getting started

This repository contains a recoverer middleware compatible with net/http which recovers from panics and sends a problem details 500 Internal Server Error response instead.

In order to use it you only need to register it in the middleware chain, either by using the default configuration or by creating your own.

About

ProblemDetails specification [RFC-7807] (https://www.rfc-editor.org/rfc/rfc7807) recoverer middleware in Go

License:MIT License


Languages

Language:Go 100.0%