erihttp

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingBody            = errors.New("missing body")
	ErrInvalidRequest         = errors.New("request is invalid")
	ErrBodyTooLarge           = errors.New("request body too large")
	ErrUnsupportedContentType = errors.New("unsupported content-type")
)

Functions

func GetBodyFromHTTPRequest

func GetBodyFromHTTPRequest(r *http.Request, maxBodySize int64) ([]byte, error)

GetBodyFromHTTPRequest performs basic request validation and returns the body if all conditions are met

Types

type AutoCompleteRequest

type AutoCompleteRequest struct {
	Domain string `json:"domain"`
}

type AutoCompleteResponse

type AutoCompleteResponse struct {
	Suggestions []string `json:"suggestions"`
	Error       string   `json:"error,omitempty"`
}

func (*AutoCompleteResponse) PrepareResponse

func (r *AutoCompleteResponse) PrepareResponse()

type ERIResponse

type ERIResponse interface {

	// Hacking around Generics, like it's 1999.
	PrepareResponse()
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer added in v0.0.9

func NewServer(mux http.Handler, config config.Config, logger logrus.FieldLogger, logWriter io.Writer, rt *runtimer.SignalHandler, handlers ...func(h http.Handler) http.Handler) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) ServeERI

func (s *Server) ServeERI() error

type SuggestRequest

type SuggestRequest struct {
	Email string `json:"email"`
}

type SuggestResponse

type SuggestResponse struct {
	Alternatives    []string `json:"alternatives"`
	MalformedSyntax bool     `json:"malformed_syntax"`
	MisconfiguredMX bool     `json:"misconfigured_mx"`
	Error           string   `json:"error,omitempty"`
}

func (*SuggestResponse) PrepareResponse

func (r *SuggestResponse) PrepareResponse()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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