http

package
v0.0.0-...-e5ac9a0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2014 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPageContent

func GetPageContent(url string) (content string, err error)

No fuss, no muss, just go get the content from this URL

func GetPageContentWithClient

func GetPageContentWithClient(url string, client Clientish) (content string, err error)

Also, but use the Clientish I supplied.

func ReadResponseBody

func ReadResponseBody(resp *http.Response) (*[]byte, error)

Types

type Clientish

type Clientish interface {
	Do(req *http.Request) (resp *http.Response, err error)
	Get(url string) (resp *http.Response, err error)
	Head(url string) (resp *http.Response, err error)
	Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
}

Mainly created to support the use of the simultaneous use of the

github.com/lumenlearning/go-utils/http/UserAgentClient and
net/http/Client types.

type UserAgentClient

type UserAgentClient struct {
	UserAgentString string
	Client          *http.Client
}

func (*UserAgentClient) Do

func (u *UserAgentClient) Do(req *http.Request) (resp *http.Response, err error)

func (*UserAgentClient) Get

func (u *UserAgentClient) Get(url string) (resp *http.Response, err error)

func (*UserAgentClient) Head

func (u *UserAgentClient) Head(url string) (resp *http.Response, err error)

func (*UserAgentClient) Post

func (u *UserAgentClient) Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error)

func (*UserAgentClient) PostForm

func (u *UserAgentClient) PostForm(url string, data url.Values) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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