rest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignRequestID

func AssignRequestID(next http.Handler) http.Handler

AssignRequestID is a middleware that assigns a unique request ID to each incoming HTTP request.

func Recoverer

func Recoverer(next http.Handler) http.Handler

Recoverer is a middleware that recovers from panics in the request handling chain and returns a 500 Internal Server Error response.

Types

type Sealer

type Sealer interface {
	Seal(urlStr, tmplStr string) (string, error)
	Unseal(token string) (urlStr, tmplStr string, err error)
}

Sealer defines methods to crypt and decrypt webhook configurations, allowing them to be safely included in URLs without exposing sensitive information or risking tampering.

type Server

type Server struct {
	Addr     string
	BaseURL  string // must be without trailing slash, e.g. http://localhost:8080
	Version  string
	Password string //nolint:gosec // intentional secret field

	Client *http.Client
	Debug  bool
	Sealer Sealer
	// contains filtered or unexported fields
}

Server remaps the incoming JSON to the request, as specified by the configuration in the URL

func (*Server) Run

func (s *Server) Run(ctx context.Context) (err error)

Run starts the server and listens for incoming requests. It blocks until the context is canceled.

Jump to

Keyboard shortcuts

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