http

package
v0.0.0-...-dcdd9e4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderChallenge     = "Www-Authenticate"
	HeaderAuthorization = "Authorization"
	HeaderContentType   = "Content-Type"
	HeaderAccept        = "Accept"
	HeaderLink          = "Link"
)

HTTP related constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Method              string    `json:"method"`
	URL                 *url.URL  `json:"url"`
	HeaderAuthorization string    `json:"authorization"`
	StartedAt           time.Time `json:"startedAt"`
}

Request represents a request made to the registry.

type Response

type Response struct {
	Code            int             `json:"code,omitempty"`
	HeaderChallenge string          `json:"Www-Authenticate,omitempty"`
	HeaderLocation  *url.URL        `json:"redirectLocation,omitempty"`
	HeaderLink      string          `json:"link,omitempty"`
	Size            int64           `json:"size,omitempty"`
	SHA256Sum       digest.Digest   `json:"sha256,omitempty"`
	Body            json.RawMessage `json:"body,omitempty"`
}

Response respresents a response received from the registry.

type RoundTripInfo

type RoundTripInfo struct {
	Request  `json:"request"`
	Response `json:"response"`
	Elapsed  string `json:"elapsed"`
}

RoundTripInfo represents information about a network round-trip.

type RoundTripper

type RoundTripper interface {
	// RoundTrip makes an HTTP request and returns the response with some stats.
	RoundTrip(req *http.Request) (RoundTripInfo, error)
}

RoundTripper provides a means to do an HTTP/HTTPs round trip.

type RoundTripperWithContext

type RoundTripperWithContext struct {
	Base   http.RoundTripper
	Logger zerolog.Logger
}

RoundTripperWithContext provides an implementation for RoundTripper.

func (RoundTripperWithContext) RoundTrip

RoundTrip does an HTTP/HTTPs roundtrip and returns the response with some contextual info.

Jump to

Keyboard shortcuts

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