http

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCookieHeader

func BuildCookieHeader(name string, value string, expires *time.Time, domain string, path string, secure bool, httpOnly bool) string

BuidlCookieHeader buidl cookie header, for example, <name>=<value>[;expires=<date>][;domain=<domain_name>][;path=<path>][;secure][;httponly]

func NewError

func NewError(gc *gin.Context, status int, err error)

Types

type Client

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

func NewClient

func NewClient(options ClientOptions, logger *logr.Logger) *Client

func (*Client) Delete

func (c *Client) Delete(target string, headers map[string]string, response interface{}) error

func (*Client) Get

func (c *Client) Get(target string, headers map[string]string, response interface{}) error

func (*Client) Patch

func (c *Client) Patch(target string, headers map[string]string, request interface{}, response interface{}) error

func (*Client) Post

func (c *Client) Post(target string, headers map[string]string, request interface{}, response interface{}) error

func (*Client) PostForm

func (c *Client) PostForm(target string, headers map[string]string, request map[string]string, response interface{}) error

func (*Client) Put

func (c *Client) Put(target string, headers map[string]string, request interface{}, response interface{}) error

type ClientOptions

type ClientOptions struct {
	Timeout int    `json:"timeout" yaml:"timeout"`
	CAFile  string `json:"caFile" yaml:"caFile"`
}

ClientOptions http client options

type DummyHealthCheckHandler

type DummyHealthCheckHandler struct {
}

DummyHealthCheckHandler dummy health check handler

func (*DummyHealthCheckHandler) Build

func (h *DummyHealthCheckHandler) Build(engine *gin.Engine)

Build build health check handler

func (*DummyHealthCheckHandler) Healthz

func (h *DummyHealthCheckHandler) Healthz(gc *gin.Context)

Healthz health check api @Produce json @Summary health check @Description check status @Success 200 {object} StatusResponse @Failure 400 {object} TTPError @Failure 503 {object} HTTPError @Router /healthz [get]

type HTTPError

type HTTPError struct {
	Code    int    `json:"code" example:"400"`
	Message string `json:"message" example:"status bad request"`
}

HTTPError error response

type Handler

type Handler interface {
	Build(engine *gin.Engine)
}

type Server

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

Server http Server

func NewServer

func NewServer(options ServerOptions, logger *logr.Logger, handlers ...Handler) *Server

NewServer create new Server

func (*Server) Start

func (c *Server) Start(ctx context.Context)

Start start http Server

func (*Server) Stop

func (c *Server) Stop(ctx context.Context)

Stop stop API Server

type ServerOptions

type ServerOptions struct {
	Host            string `json:"host" yaml:"host"`
	Port            int    `json:"port" yaml:"port"`
	CAFile          string `json:"caFile" yaml:"caFile"`
	PrivateKeyFile  string `json:"privateKetFile" yaml:"privateKeyFile"`
	PublicCertFile  string `json:"publicCertFile" yaml:"publicCertFile"`
	EnableProfiling bool   `json:"enableProfiling" yaml:"enableProfiling"`
}

Options http server options

type StatusResponse

type StatusResponse struct {
	Message string `json:"message"`
}

StatusResponse status response

Jump to

Keyboard shortcuts

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