problem: Index | Files

package problem

import ""


Package Files


type Option Uses

type Option interface {
    // contains filtered or unexported methods

An Option configures a Problem using the functional options paradigm popularized by Rob Pike.

func Custom Uses

func Custom(key string, value interface{}) Option

Custom sets a custom key value

func Detail Uses

func Detail(detail string) Option

Detail A human readable explanation specific to this occurrence of the problem.

func Instance Uses

func Instance(uri string) Option

Instance an absolute URI that identifies the specific occurrence of the problem.

func Status Uses

func Status(status int) Option

Status sets the HTTP status code generated by the origin server for this occurrence of the problem.

func Title Uses

func Title(title string) Option

Title sets a title that appropriately describes it (think short) Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable

func Type Uses

func Type(uri string) Option

Type sets the type URI (typically, with the "http" or "https" scheme) that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type

type Problem Uses

type Problem struct {
    // contains filtered or unexported fields

func New Uses

func New(opts ...Option) *Problem

New generates a new Problem

func (*Problem) Append Uses

func (p *Problem) Append(opts ...Option) *Problem

Append an Option to a existing Problem

func (Problem) JSON Uses

func (p Problem) JSON() []byte

JSON returns the Problem as json bytes

func (Problem) JSONString Uses

func (p Problem) JSONString() string

JSONString returns the Problem as json string

func (Problem) WriteTo Uses

func (p Problem) WriteTo(w http.ResponseWriter) (int, error)

WriteTo writes the Problem to a http Response Writer

Package problem imports 2 packages (graph). Updated 2019-08-07. Refresh now. Tools for package owners.