go-git.v4: gopkg.in/src-d/go-git.v4/plumbing/transport/http Index | Files

package http

import "gopkg.in/src-d/go-git.v4/plumbing/transport/http"

Package http implements the HTTP transport protocol.

Index

Package Files

common.go receive_pack.go upload_pack.go

Variables

var DefaultClient = NewClient(nil)

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

func NewClient Uses

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 Uses

func NewErr(r *http.Response) error

NewErr returns a new Err based on a http response

type AuthMethod Uses

type AuthMethod interface {
    transport.AuthMethod
    SetAuth(r *http.Request)
}

AuthMethod is concrete implementation of common.AuthMethod for HTTP services

type BasicAuth Uses

type BasicAuth struct {
    Username, Password string
}

BasicAuth represent a HTTP basic auth

func (*BasicAuth) Name Uses

func (a *BasicAuth) Name() string

Name is name of the auth

func (*BasicAuth) SetAuth Uses

func (a *BasicAuth) SetAuth(r *http.Request)

func (*BasicAuth) String Uses

func (a *BasicAuth) String() string

type Err Uses

type Err struct {
    Response *http.Response
}

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

func (*Err) Error Uses

func (e *Err) Error() string

func (*Err) StatusCode Uses

func (e *Err) StatusCode() int

StatusCode returns the status code of the response

type TokenAuth Uses

type TokenAuth struct {
    Token string
}

TokenAuth implements an http.AuthMethod that can be used with http transport to authenticate with HTTP token authentication (also known as bearer authentication).

IMPORTANT: If you are looking to use OAuth tokens with popular servers (e.g. GitHub, Bitbucket, GitLab) you should use BasicAuth instead. These servers use basic HTTP authentication, with the OAuth token as user or password. Check the documentation of your git server for details.

func (*TokenAuth) Name Uses

func (a *TokenAuth) Name() string

Name is name of the auth

func (*TokenAuth) SetAuth Uses

func (a *TokenAuth) SetAuth(r *http.Request)

func (*TokenAuth) String Uses

func (a *TokenAuth) String() string

Package http imports 16 packages (graph) and is imported by 64 packages. Updated 2019-08-01. Refresh now. Tools for package owners.