rfc7807

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 3 Imported by: 0

README

go-lib

A template repository for Go libraries.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimpleResponse

func SimpleResponse(w http.ResponseWriter, status int, title string) error

SimpleResponse writes a simple response with the RFC7807 struct to the provided writer.

Types

type RFC7807

type RFC7807 struct {
	Type       string         `json:"type,omitempty"`
	Title      string         `json:"title"`
	Status     int            `json:"status,omitempty"`
	Detail     string         `json:"detail,omitempty"`
	Instance   string         `json:"instance,omitempty"`
	Extensions map[string]any `json:"extensions,omitempty"`
}

RFC7807 is a struct that represents the RFC7807 standard.

func NewError

func NewError(title string) *RFC7807

NewError returns a new RFC7807 struct.

func (*RFC7807) SetDetail

func (e *RFC7807) SetDetail(d string) *RFC7807

SetDetail sets the detail field of the RFC7807 struct.

func (*RFC7807) SetExtensions

func (e *RFC7807) SetExtensions(ext map[string]any) *RFC7807

SetExtensions sets the extensions field of the RFC7807 struct.

func (*RFC7807) SetInstance

func (e *RFC7807) SetInstance(i string) *RFC7807

SetInstance sets the instance field of the RFC7807 struct.

func (*RFC7807) SetStatus

func (e *RFC7807) SetStatus(s int) *RFC7807

SetStatus sets the status field of the RFC7807 struct.

func (*RFC7807) SetType

func (e *RFC7807) SetType(t string) *RFC7807

SetType sets the type field of the RFC7807 struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL