http

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: MIT Imports: 17 Imported by: 3

Documentation

Overview

Package httpclient implement tel http.client wrapper which help to handle error The most important approach: perform logs by itself

DEPRECATED: use transport inside http.client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Get(_ctx context.Context, url string) (resp *http.Response, err error)
	Post(_ctx context.Context, url, contentType string, body []byte) (resp *http.Response, err error)
	PostForm(ctx context.Context, url string, data url.Values) (resp *http.Response, err error)
}

func New

func New(ca []byte) Interface

type Server

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

func NewServer

func NewServer(t *tel.Telemetry) *Server

func (*Server) HTTPServerMiddleware

func (s *Server) HTTPServerMiddleware() func(next http.Handler) http.Handler

HTTPServerMiddleware perform: * telemetry log injection * measure execution time * recovery

func (*Server) HTTPServerMiddlewareAll

func (s *Server) HTTPServerMiddlewareAll(m metrics.HTTPTracker) func(next http.Handler) http.Handler

HTTPServerMiddlewareAll represent all essential metrics Execution order:

  • opentracing injection via nethttp.Middleware
  • recovery + measure execution time + debug log via own HTTPServerMiddleware
  • metrics via metrics.NewHTTPMiddlewareWithOption

Jump to

Keyboard shortcuts

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