Skip to content

Simple Go library implementing RFC 7807 (Problem Details for HTTP APIs)

License

Notifications You must be signed in to change notification settings

MartyHub/problem

Repository files navigation

Problem

Problem is a simple Go library implementing RFC 7807: Problem Details for HTTP APIs.

build Go Report Card

Usage

package sample

import (
	"errors"
	"net/http"
	
	"github.com/MartyHub/problem"
)

func ServeHTTP(writer http.ResponseWriter, req *http.Request) {
	problem.Write(writer, problem.New(http.StatusForbidden, "Your current balance is 30, but that costs 50.").
		Error(errors.New("an optional error")).
		Request(req),
	)
}

About

Simple Go library implementing RFC 7807 (Problem Details for HTTP APIs)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published