client

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClientBuilder

type HTTPClientBuilder interface {
	SetConfig(conf configuration.Config) HTTPClientBuilder
	AddInterceptors(...HTTPClientInterceptor) HTTPClientBuilder
	WithPreconfiguredClient(*http.Client) HTTPClientBuilder
	Build() (HttpClient, error)
}

HTTPClientBuilder is a builder interface to build http.Client with interceptors

type HTTPClientInterceptor

type HTTPClientInterceptor func(*http.Request, HTTPHandler) (*http.Response, error)

HTTPClientInterceptor is a user defined function that can alter a request before it's sent and/or alter a response before it's returned to the caller

type HTTPHandler

type HTTPHandler func(*http.Request) (*http.Response, error)

HTTPHandler is just an alias to http.RoundTriper.RoundTrip function

type HttpClient

type HttpClient interface {
	InternalClient
	Post(c context.Context, payload interface{}, host, handler string, target interface{}, headers map[string]string) servicereply.ServiceReply
	Get(c context.Context, host, handler string, target interface{}, headers map[string]string) servicereply.ServiceReply
	ExternalGet(c context.Context, host, handler string, payload map[string]string, target interface{},
		headers map[string]string, contentType string) servicereply.ServiceReply
	Put(c context.Context, payload interface{}, host, handler string, target interface{}, headers map[string]string) servicereply.ServiceReply
	Delete(c context.Context, host, handler string, target interface{}, headers map[string]string) servicereply.ServiceReply
	PostForm(c context.Context, uri string, postData, headers map[string]string) ([]byte, servicereply.ServiceReply)
	SetDiscoveryServiceProvider(dsp discoveryService.DiscoveryServiceProvider)
}

type InternalClient

type InternalClient interface {
	Call(c context.Context, payload interface{}, host, handler string, target interface{}, headers map[string]string) servicereply.ServiceReply
}

type NewHTTPClientBuilder

type NewHTTPClientBuilder func() HTTPClientBuilder

NewHTTPClientBuilder REST HTTP builder

Useful when you want to create several *http.Client with different options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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