transport

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: BSD-3-Clause Imports: 1 Imported by: 6

Documentation

Overview

Package transport provides facilities for setting up authenticated http.RoundTripper given credentials and base RoundTripper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	Base http.RoundTripper

	Scheme      string
	Credentials string
}

Authorization is an http.RoundTripper that makes HTTP requests, wrapping a base RoundTripper and adding an Authorization header with credentials

func (*Authorization) RoundTrip

func (t *Authorization) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip adds the Authorization header to the request.

type BasicAuth

type BasicAuth struct {
	Base http.RoundTripper

	Username string
	Password string
}

BasicAuth is an http.RoundTripper that makes HTTP requests, wrapping a base RoundTripper and adding a Basic Authorization header.

func (*BasicAuth) RoundTrip

func (t *BasicAuth) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip adds the Authorization header to the request.

type BearerToken

type BearerToken struct {
	Base http.RoundTripper

	Token string // Bearer token
}

BearerToken is an http.RoundTripper that makes HTTP requests, wrapping a base RoundTripper and adding an Authorization header with the Bearer Token.

func (*BearerToken) RoundTrip

func (t *BearerToken) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip adds the Authorization header to the request.

type Custom

type Custom struct {
	Base http.RoundTripper

	// Before defines an func to mutate the http.Request
	// before the transaction is executed.
	Before func(*http.Request)
}

Custom is an http.RoundTripper that can be used to implement custom HTTP request authorization.

func (*Custom) RoundTrip

func (t *Custom) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip authorizes and authenticates the request with a user-defined function.

type PrivateToken

type PrivateToken struct {
	Base http.RoundTripper

	Token string // GitLab personal token
}

PrivateToken is an http.RoundTripper that makes HTTP requests, wrapping a base RoundTripper and adding an Private-Token header with the GitLab personal token.

func (*PrivateToken) RoundTrip

func (t *PrivateToken) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip adds the PrivateToken header to the request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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