httpclient

package
v1.0.36 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Send(ctx context.Context, req *Request) (*Response, error)
}

Client interface for making HTTP requests

func NewClientWithConfig added in v1.0.27

func NewClientWithConfig(config ClientConfig) Client

NewClientWithConfig creates a new DefaultClient with custom configuration

func NewDefaultClient

func NewDefaultClient() Client

NewDefaultClient creates a new DefaultClient

type ClientConfig

type ClientConfig struct {
	Timeout time.Duration
}

ClientConfig holds configuration for the HTTP client

type DefaultClient

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

DefaultClient implements the Client interface

func (*DefaultClient) Send

func (c *DefaultClient) Send(ctx context.Context, req *Request) (*Response, error)

Send makes an HTTP request and returns the response

type Error

type Error struct {
	*ierr.InternalError
	StatusCode int
	Response   []byte
}

Error represents an HTTP client error

func IsHTTPError

func IsHTTPError(err error) (*Error, bool)

IsHTTPError checks if an error is an HTTP client error

func NewError

func NewError(statusCode int, response []byte) *Error

NewError creates a new HTTP client error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Request

type Request struct {
	Method  string
	URL     string
	Headers map[string]string
	Body    []byte
}

Request represents an HTTP request

type Response

type Response struct {
	StatusCode int
	Body       []byte
	Headers    map[string]string
}

Response represents an HTTP response

Jump to

Keyboard shortcuts

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