http

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpOptions

type HttpOptions struct {
	Headers     map[string]string
	QueryParams map[string]string
}

type HttpResponse

type HttpResponse struct {
	StatusCode int
	Body       interface{}
	RawBody    []byte
	Header     http.Header
}

func (*HttpResponse) GetBody

func (r *HttpResponse) GetBody() interface{}

func (*HttpResponse) GetHeader

func (r *HttpResponse) GetHeader() http.Header

func (*HttpResponse) GetRawBody

func (r *HttpResponse) GetRawBody() []byte

func (*HttpResponse) GetStatusCode

func (r *HttpResponse) GetStatusCode() int

func (*HttpResponse) HasBody

func (r *HttpResponse) HasBody() bool

type HttpService

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

func (*HttpService) Get

func (s *HttpService) Get(ctx context.Context, url string, options HttpOptions) (IHttpResponse, error)

Get performs a GET request to the given URL.

type IHttpResponse

type IHttpResponse interface {
	GetStatusCode() int
	HasBody() bool
	GetBody() interface{}
	GetRawBody() []byte
	GetHeader() http.Header
}

type IHttpService

type IHttpService interface {
	Get(ctx context.Context, url string, options HttpOptions) (IHttpResponse, error)
}

func NewHttpService

func NewHttpService(config *config.Config, userAgent string) IHttpService

func NewMockHttpService

func NewMockHttpService(t *testing.T) IHttpService

type MockHttpResponse

type MockHttpResponse struct {
	mock.Mock
}

func NewMockHttpResponse

func NewMockHttpResponse(t *testing.T) *MockHttpResponse

func (*MockHttpResponse) GetBody

func (m *MockHttpResponse) GetBody() interface{}

func (*MockHttpResponse) GetHeader

func (m *MockHttpResponse) GetHeader() http.Header

func (*MockHttpResponse) GetRawBody

func (m *MockHttpResponse) GetRawBody() []byte

func (*MockHttpResponse) GetStatusCode

func (m *MockHttpResponse) GetStatusCode() int

func (*MockHttpResponse) HasBody

func (m *MockHttpResponse) HasBody() bool

type MockHttpService

type MockHttpService struct {
	mock.Mock
}

func (*MockHttpService) Get

func (m *MockHttpService) Get(ctx context.Context, url string, options HttpOptions) (IHttpResponse, error)

Jump to

Keyboard shortcuts

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