httputils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package httputils is a generated GoMock package.

Index

Constants

View Source
const Timeout = 30 * time.Second

Variables

This section is empty.

Functions

func CloseBody

func CloseBody(ctx context.Context, resp *http.Response)

func ReadBody

func ReadBody(body io.ReadCloser) ([]byte, error)

ReadBody reads the body of a response and returns it as a byte slice.

func ReadBodyJSON

func ReadBodyJSON(body io.ReadCloser, v interface{}) error

ReadBodyJSON reads the body of a response and unmarshals the JSON into the given interface

Types

type Downloader

type Downloader interface {
	Download(ctx context.Context, url string) ([]byte, error)
}

func NewDownloader

func NewDownloader(userAgent string) Downloader

type MockDownloader

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

MockDownloader is a mock of Downloader interface.

func NewMockDownloader

func NewMockDownloader(ctrl *gomock.Controller) *MockDownloader

NewMockDownloader creates a new mock instance.

func (*MockDownloader) Download

func (m *MockDownloader) Download(ctx context.Context, url string) ([]byte, error)

Download mocks base method.

func (*MockDownloader) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockDownloaderMockRecorder

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

MockDownloaderMockRecorder is the mock recorder for MockDownloader.

func (*MockDownloaderMockRecorder) Download

func (mr *MockDownloaderMockRecorder) Download(ctx, url interface{}) *gomock.Call

Download indicates an expected call of Download.

type UserAgents

type UserAgents interface {
	GetLatest(ctx context.Context) ([]string, error)
	GetRandom(ctx context.Context) (string, error)
}

UserAgents used for getting the latest browser user agents

func NewLatestUserAgents

func NewLatestUserAgents(client *http.Client) UserAgents

Jump to

Keyboard shortcuts

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