http

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BrowserDebugLogger = &DebugLogger{
	entries: make([]DebugLogEntry, 0),
	maxSize: 100,
}

Global debug logger instance

Functions

func FetchArray

func FetchArray(path, idField string) ([]any, error)

fetchArray calls the given path (and expects it to return an array), and paginates to fetch all the results. If "idField" given, it tries to extract the given field from the objects returned by the API call.

func FetchExpandedArray

func FetchExpandedArray(path, idField string) ([]map[string]any, error)

func FetchObjectsParallel

func FetchObjectsParallel[T any](path string, ids []any, ignoreErrors bool) ([]T, error)

func InitClient

func InitClient()

func InitClientWithProfile added in v0.10.0

func InitClientWithProfile(cfg *ini.File, profileOverride string)

func NewTransport deprecated

func NewTransport(name string, t http.RoundTripper) *transport

NewTransport creates a wrapper around a *http.RoundTripper, designed to be used for the `Transport` field of http.Client.

This logs each pair of HTTP request/response that it handles. The logging is done via Go standard library `log` package.

Deprecated: This will log the content of every http request/response at `[DEBUG]` level, without any filtering. Any sensitive information will appear as-is in your logs. Please use NewSubsystemLoggingHTTPTransport instead.

Types

type APIClient added in v0.17.0

type APIClient struct {
	*ovh.Client
	// contains filtered or unexported fields
}

APIClient strips the "/v1" prefix on non-official "/1.0" endpoints, where go-ovh's root-aliasing does not hold.

var Client *APIClient

OVH API client

func NewAPIClient added in v0.17.0

func NewAPIClient(raw *ovh.Client) *APIClient

NewAPIClient wraps an already-configured *ovh.Client.

func (*APIClient) Delete added in v0.17.0

func (c *APIClient) Delete(path string, resType interface{}) error

func (*APIClient) Get added in v0.17.0

func (c *APIClient) Get(path string, resType interface{}) error

func (*APIClient) NewRequest added in v0.17.0

func (c *APIClient) NewRequest(method, path string, reqBody interface{}, needAuth bool) (*http.Request, error)

func (*APIClient) Patch added in v0.17.0

func (c *APIClient) Patch(path string, reqBody, resType interface{}) error

func (*APIClient) Post added in v0.17.0

func (c *APIClient) Post(path string, reqBody, resType interface{}) error

func (*APIClient) Put added in v0.17.0

func (c *APIClient) Put(path string, reqBody, resType interface{}) error

type DebugLogEntry added in v0.10.0

type DebugLogEntry struct {
	Timestamp   time.Time
	Method      string
	URL         string
	QueryString string
	StatusCode  int
	RequestID   string
	Duration    time.Duration
	Error       string
}

DebugLogEntry represents a single API request/response log entry

func (DebugLogEntry) Format added in v0.10.0

func (e DebugLogEntry) Format() string

Format formats a log entry for display

type DebugLogger added in v0.10.0

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

DebugLogger holds the debug log entries for the browser

func (*DebugLogger) AddEntry added in v0.10.0

func (dl *DebugLogger) AddEntry(entry DebugLogEntry)

AddEntry adds a new log entry

func (*DebugLogger) Clear added in v0.10.0

func (dl *DebugLogger) Clear()

Clear removes all log entries

func (*DebugLogger) GetEntries added in v0.10.0

func (dl *DebugLogger) GetEntries() []DebugLogEntry

GetEntries returns a copy of all log entries

Jump to

Keyboard shortcuts

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