http

package
v0.0.0-...-21b7097 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

a client for making HTTP requests

func NewClient

func NewClient(server *Server, native *http.Client) *Client

creates a new client for communicating with an HTTP server

func NewDefaultClient

func NewDefaultClient(server *Server) *Client

creates a new client for communicating with a server uses the default HTTP client from net/http

func (*Client) Do

func (c *Client) Do(req *Request) (*Response, error)

executes an HTTP request

func (*Client) Native

func (c *Client) Native() *http.Client

downcasts to the native HTTP interface

func (*Client) Server

func (c *Client) Server() *Server

returns the embedded HTTP server reference

func (*Client) SetHeader

func (c *Client) SetHeader(key string, value string)

func (*Client) SetServer

func (c *Client) SetServer(s *Server)

type Request

type Request http.Request

an HTTP request object

func NewRequest

func NewRequest(method string, urlstr string, body ...io.ReadCloser) (*Request, error)

creates a new HTTP request object

func (*Request) Native

func (r *Request) Native() *http.Request

downcasts the request to the native HTTP interface

type Response

type Response http.Response

an HTTP response object

func NewResponse

func NewResponse(response *http.Response) *Response

creates a new HTTP response object

func (*Response) Native

func (r *Response) Native() *http.Response

downcasts the response to the native HTTP interface

type Server

type Server struct {
	// contains filtered or unexported fields
}

a server that accepts HTTP requests

func NewServer

func NewServer(baseUrlStr string) (*Server, error)

creates a reference to an http server

func (*Server) AbsUrlStr

func (s *Server) AbsUrlStr(path string) string

converts a path name to an absolute URL

func (*Server) NewRequest

func (s *Server) NewRequest(method string, path string, body ...io.ReadCloser) (*Request, error)

creates a new HTTP request object

func (*Server) UserInfo

func (s *Server) UserInfo() *url.Userinfo

converts a path name to an absolute URL

Jump to

Keyboard shortcuts

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