http

package
v1.23.6 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package http defines the HTTP client used to interact with the Snyk Code API.

Index

Constants

View Source
const NoRequestId = ""

Variables

This section is empty.

Functions

func AddDefaultHeaders added in v1.23.3

func AddDefaultHeaders(req *http.Request, requestId string, orgId string, method string)

func EncodeIfNeeded added in v1.23.5

func EncodeIfNeeded(method string, requestBody []byte) (*bytes.Buffer, error)

EncodeIfNeeded returns a byte buffer for the requestBody. Depending on the request method, it may encode the buffer. (See http.mustBeEncoded for the list of methods which require encoding the request body.)

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

func NewHTTPClient

func NewHTTPClient(
	httpClientFactory HTTPClientFactory,
	options ...OptionFunc,
) HTTPClient

type HTTPClientFactory added in v1.4.4

type HTTPClientFactory func() *http.Client

func NewDefaultClientFactory added in v1.14.0

func NewDefaultClientFactory() HTTPClientFactory

type OptionFunc added in v1.4.2

type OptionFunc func(*httpClient)

func WithErrorReporter added in v1.4.2

func WithErrorReporter(errorReporter observability.ErrorReporter) OptionFunc

func WithInstrumentor added in v1.4.2

func WithInstrumentor(instrumentor observability.Instrumentor) OptionFunc

func WithLogger added in v1.4.2

func WithLogger(logger *zerolog.Logger) OptionFunc

func WithRetryCount added in v1.4.2

func WithRetryCount(retryCount int) OptionFunc

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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