http

package
v4.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package http implements the HTTP transport protocol.

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = NewClient(nil)

DefaultClient is the default HTTP client, which uses `http.DefaultClient`.

Functions

func NewClient

func NewClient(c *http.Client) transport.Transport

NewClient creates a new client with a custom net/http client. See `InstallProtocol` to install and override default http client. Unless a properly initialized client is given, it will fall back into `http.DefaultClient`.

Note that for HTTP client cannot distinguist between private repositories and unexistent repositories on GitHub. So it returns `ErrAuthorizationRequired` for both.

func NewErr

func NewErr(r *http.Response) error

NewErr returns a new Err based on a http response

Types

type AuthMethod

type AuthMethod interface {
	transport.AuthMethod
	// contains filtered or unexported methods
}

AuthMethod is concrete implementation of common.AuthMethod for HTTP services

type BasicAuth

type BasicAuth struct {
	Username, Password string
}

BasicAuth represent a HTTP basic auth

func (*BasicAuth) Name

func (a *BasicAuth) Name() string

Name is name of the auth

func (*BasicAuth) String

func (a *BasicAuth) String() string

type Err

type Err struct {
	Response *http.Response
}

Err is a dedicated error to return errors based on status code

func (*Err) Error

func (e *Err) Error() string

func (*Err) StatusCode

func (e *Err) StatusCode() int

StatusCode returns the status code of the response

type TokenAuth added in v4.5.0

type TokenAuth struct {
	Token string
}

TokenAuth implements the go-git http.AuthMethod and transport.AuthMethod interfaces

func (*TokenAuth) Name added in v4.5.0

func (a *TokenAuth) Name() string

Name is name of the auth

func (*TokenAuth) String added in v4.5.0

func (a *TokenAuth) String() string

Jump to

Keyboard shortcuts

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