httpserver

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPResponder added in v0.0.3

type HTTPResponder struct {
	Logger log.Logger
}

func NewHTTPResponder added in v0.0.3

func NewHTTPResponder(l log.Logger) HTTPResponder

func (HTTPResponder) Reply added in v0.0.3

func (a HTTPResponder) Reply(w http.ResponseWriter, status int, rsp any)

func (HTTPResponder) ReplyOK added in v0.0.3

func (a HTTPResponder) ReplyOK(w http.ResponseWriter, rsp any)

func (HTTPResponder) ReplyWithError added in v0.0.3

func (a HTTPResponder) ReplyWithError(w http.ResponseWriter, err error)

type HTTPServer

type HTTPServer struct {
	http.Server
	// contains filtered or unexported fields
}

func New

func New(endpoint string, handler http.Handler) *HTTPServer

func (*HTTPServer) IsReady

func (s *HTTPServer) IsReady() bool

IsReady returns true if the server is ready to handle http requests.

func (*HTTPServer) RealAddress

func (s *HTTPServer) RealAddress() string

RealAddress returns the address the server is running on.

func (*HTTPServer) Run

func (s *HTTPServer) Run()

Run listens and serves http requests. It returns only after the server is stopped.

func (*HTTPServer) Stop

func (s *HTTPServer) Stop()

Stop tries to stop the server synchronously. It panics if the server is not stopped after 5s.

func (*HTTPServer) WaitReady

func (s *HTTPServer) WaitReady()

WaitReady returns only after the server is ready to handle http requests.

Jump to

Keyboard shortcuts

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