fhclient

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AcceptJSON     = "application/json"
	AcceptXML      = "application/xml"
	ContentJSON    = "application/json; charset=utf-8"
	ContentXML     = "application/xml; charset=utf-8"
	ContentTextXML = "text/xml; charset=utf-8"

	HTTPMethodPOST  = "POST"
	HTTPMethodPUT   = "PUT"
	HTTPMethodPATCH = "PATCH"
	HTTPMethodGET   = "GET"

	DefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WebClient

type WebClient struct {
	TargetService  string
	BaseURI        string
	JwtToken       string
	UserAgent      string
	ContentType    string
	Accept         string
	TimeOut        time.Duration
	Debug          bool
	Authentication bool
	GzipRequest    bool
	// contains filtered or unexported fields
}

func New

func New(cfg contracts.SideRestServiceInterface, serviceName string) *WebClient

New creates Default setup for default fast http client.

func (*WebClient) FastGet

func (w *WebClient) FastGet(ctx context.Context, requestURI string) (*fasthttp.Response, error)

FastGet do GET request via fasthttp.

func (*WebClient) FastPatchByte

func (w *WebClient) FastPatchByte(ctx context.Context, requestURI string, body []byte) (*fasthttp.Response, error)

FastPatchByte do PATCH request via fasthttp.

func (*WebClient) FastPostByte

func (w *WebClient) FastPostByte(ctx context.Context, requestURI string, body []byte) (*fasthttp.Response, error)

FastPostByte do POST request via fasthttp.

func (*WebClient) FastPutByte

func (w *WebClient) FastPutByte(ctx context.Context, requestURI string, body []byte) (*fasthttp.Response, error)

FastPutByte do PUT request via fasthttp.

func (*WebClient) SetLogger

func (w *WebClient) SetLogger(logger log.Logger) *WebClient

type WebClientInterface

type WebClientInterface interface {
	SetLogger(logger log.Logger)
	FastPostByte(ctx context.Context, requestURI string, body []byte) (*fasthttp.Response, error)
	FastPutByte(ctx context.Context, requestURI string, body []byte) (*fasthttp.Response, error)
	FastPatchByte(ctx context.Context, requestURI string, body []byte) (*fasthttp.Response, error)
	FastGet(ctx context.Context, requestURI string) (*fasthttp.Response, error)
}

Jump to

Keyboard shortcuts

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