remux

package
v0.0.0-...-0fdad32 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DissectFormRequest

func DissectFormRequest(r *http.Request) dissectors.DissectedRequest

DissectFormRequest is a gorilla.mux focused rewrap of dissectors.DissectFormRequest

func DissectJSONRequest

func DissectJSONRequest(r *http.Request) dissectors.DissectedRequest

DissectJSONRequest is a gorilla.mux focused rewrap of dissectors.DissectJSONRequest

func DissectNoBodyRequest

func DissectNoBodyRequest(r *http.Request) dissectors.DissectedRequest

DissectNoBodyRequest is a gorilla.mux focused rewrap of dissectors.DissectPlainRequest

func HandleError

func HandleError(w http.ResponseWriter, r *http.Request, rootErr error)

HandleError will set the proper status code for the given error and return a json response body with a public reason listed

Note: In general, users should prefer to use JSONHandler or MediaHandler. This function should only be used in instances where those handlers cannot be used (e.g. because of a redirect)

func JSONHandler

func JSONHandler(handler func(*http.Request) (interface{}, error)) http.HandlerFunc

JSONHandler provides a generic handler for any request that prefers JSON responses. In all success scenarios, and most error scenarios, json is returned. The exception here is when this project cannot decode/Marshal a JSON message, in which case a plain 500 error with no content is returned.

func MediaHandler

func MediaHandler(handler func(*http.Request) (io.Reader, error)) http.Handler

MediaHandler provides a generic handler for any content that _prefers_ a return value as raw data. In success situtations, the response will be returned as just a stream of bytes. In failure cases the output will instead be json, which conforms to the remainder of the project

func Route

func Route(r chi.Router, method string, path string, handler http.Handler)

Route rewraps chi's Handle/Methods to provide a better at-a-glance reading of route definitions

Types

type StackTraceEntry

type StackTraceEntry struct {
	File       string
	LineNumber int
}

StackTraceEntry is a small structure for holding relevent data pertaining to a single line in a stacktrace.

Jump to

Keyboard shortcuts

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