http_worker

package
v0.0.0-...-f18d551 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetURLPathParts

func GetURLPathParts(url *url.URL) []string

func HandleErrorResponse

func HandleErrorResponse(responseWriter http.ResponseWriter, request *http.Request, statusCode int, errorToSend error) error

func HandleResponse

func HandleResponse(responseWriter http.ResponseWriter, request *http.Request, statusCode int, response interface{}) error

Types

type ErrorResponse

type ErrorResponse struct {
	Response
	Method string `json:"method"`
	URL    string `json:"url"`
	Error  string `json:"error"`
}

func GetErrorResponse

func GetErrorResponse(detail string, method string, url string, err error) ErrorResponse

type Response

type Response struct {
	Success bool   `json:"success"`
	Detail  string `json:"detail,omitempty"`
}

func GetSuccessResponse

func GetSuccessResponse(detail string) Response

type Worker

type Worker struct {
	lifecycles.Worker
	// contains filtered or unexported fields
}

func New

func New(name string, port int64, handlerByPattern map[string]http.HandlerFunc) *Worker

Jump to

Keyboard shortcuts

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