fhttp

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderKeyRequestID = "X-Request-Id"
)

Variables

This section is empty.

Functions

func Client

func Client() *resty.Client

func ContextWith

func ContextWith(ctx context.Context, key interface{}, value interface{}) context.Context

func ContextWithRequestID

func ContextWithRequestID(ctx context.Context, requestID string) context.Context

func Execute

func Execute(request *resty.Request, method, url string, body interface{}, resp interface{}) (int, models.Err)

func ParseResponse

func ParseResponse(r *resty.Response, obj interface{}) models.Err

func Request

func Request(ctx context.Context) *resty.Request

func RequestIdFromContext

func RequestIdFromContext(ctx context.Context) string

func RequestWithID

func RequestWithID(ctx context.Context, requestID string) *resty.Request

Types

type ContextKey

type ContextKey string
const (
	ContextKeyBasicAuth  ContextKey = "ck_basic_auth"
	ContextKeyBearerAuth ContextKey = "ck_bearer_auth"
	ContextKeyRequestID  ContextKey = "ck_request_id"
)

type DataWrapperResponse

type DataWrapperResponse struct {
	FError
	Data *json.RawMessage `json:"data"`
}

type FContext

type FContext struct {
	context.Context
}

func NewFContext

func NewFContext(ctx context.Context) FContext

func (*FContext) With

func (c *FContext) With(key interface{}, value interface{}) *FContext

func (*FContext) WithRequestID

func (c *FContext) WithRequestID(requestID string) *FContext

type FError

type FError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func (*FError) Error

func (e *FError) Error() string

Jump to

Keyboard shortcuts

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