http

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string) *Client

func (*Client) CommonDoFromRequest

func (c *Client) CommonDoFromRequest(req *http.Request, output interface{}) (int, error)

func (*Client) CommonDoWithForm

func (c *Client) CommonDoWithForm(method, path string, headers map[string]string, input url.Values) (int, []byte, error)

func (*Client) CommonDoWithJSON

func (c *Client) CommonDoWithJSON(method, path string, headers map[string]string, input, output interface{}) (int, error)

func (*Client) MakeJSONRequest

func (c *Client) MakeJSONRequest(method, path string, headers map[string]string, input interface{}) (*http.Request, error)

func (*Client) WithBaseURL

func (c *Client) WithBaseURL(baseURL string) *Client

func (*Client) WithHeaders

func (c *Client) WithHeaders(key string, value string) *Client

func (*Client) WithTimeout

func (c *Client) WithTimeout(timeout time.Duration) *Client

type Config

type Config struct {
	WriteTimeout time.Duration
	ReadTimeout  time.Duration
}

type Controller

type Controller interface {
	RegisterHandlers(*mux.Router)
}

type MuxServer

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

func NewMuxServer

func NewMuxServer(port int, cfg Config) *MuxServer

func (*MuxServer) Serve

func (s *MuxServer) Serve(ctx context.Context) error

Serve starts the server.

func (*MuxServer) Shutdown

func (s *MuxServer) Shutdown(ctx context.Context) error

func (*MuxServer) WithAdditionalHandlers

func (s *MuxServer) WithAdditionalHandlers(pathHandlerPair ...interface{}) *MuxServer

func (*MuxServer) WithControllers

func (s *MuxServer) WithControllers(handlers ...Controller) *MuxServer

func (*MuxServer) WithMiddlewares

func (s *MuxServer) WithMiddlewares(fn ...mux.MiddlewareFunc) *MuxServer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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