http

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct{}

Body is a context tag for the request body.

type CACert

type CACert struct{}

CaCert is a context tag for the CA certificate.

type ClientCert

type ClientCert struct{}

ClientCert is a context tag for the client certificate.

type ClientKey

type ClientKey struct{}

ClientKey is a context tag for the client key.

type HTTPMethod

type HTTPMethod struct{}

HTTPMethod is a context tag for the HTTP method.

type MIMEType

type MIMEType struct{}

MIMEType is a context tag for the MIME type.

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithCACert

func WithCACert(cert []byte) Parameter

WithCACert sets the certificate authority certificate for HTTPS requests.

func WithClientCert

func WithClientCert(cert []byte) Parameter

WithClientCert sets the client certificate for HTTPS requests.

func WithClientKey

func WithClientKey(key []byte) Parameter

WithClientKey sets the client Key for HTTPS requests.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

type Service

type Service struct{}

Service returns the values from an HTTP connection. This service handles URLs with the scheme "http" and "https". It returns the file at the URL as the value. For example a URL "http://www.example.com/secret.txt" will return the contents of the file "secret.txt" on the server "www.example.com" Additional information, such as certificates, can be passed as context values. The available values are: - CACert a certificate authority certificate, as a byte slice - ClientCert a client certificate, as a byte slice - ClientKey a client key, as a byte slice - HTTPMethod the HTTP method, as a string (e.g. http.MethodPost) - MIMEType the MIME type for request and response, as a string (e.g. application/json) - Body the request body, as a byte slice

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new file confidant.

func (*Service) Fetch

func (s *Service) Fetch(ctx context.Context, url *url.URL) ([]byte, error)

Fetch fetches a value given its https URL.

func (*Service) SupportedURLSchemes

func (s *Service) SupportedURLSchemes(ctx context.Context) ([]string, error)

SupportedURLSchemes provides the list of schemes supported by this confidant.

Jump to

Keyboard shortcuts

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