gobhttp

package module
v0.0.0-...-3bec2ed Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

README

go-gob-http

It is a gob encodable version of http.Request and http.Response.

$ go build .

$ go get github.com/liquidgecka/testlib
$ go test .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GobRequest

type GobRequest struct {
	Method           string
	URL              string
	Proto            string
	ProtoMajor       int
	ProtoMinor       int
	Header           http.Header
	ContentLength    int64
	TransferEncoding []string
	Close            bool
	Host             string
	Form             url.Values
	PostForm         url.Values
	Trailer          http.Header
	RemoteAddr       string
	RequestURI       string
	TLS              *tls.ConnectionState

	// The request body and err returned when reading it.
	Body  []byte
	Error gobError
}

This is a gob encodable version of http.Request. It removes the possibility that a private field can be seen and therefor return an error.

func NewGobRequest

func NewGobRequest(req *http.Request) *GobRequest

This takes a Request object and returns a gob compatible GobRequest object.

type GobResponse

type GobResponse struct {
	Status           string
	StatusCode       int
	Proto            string
	ProtoMajor       int
	ProtoMinor       int
	Header           http.Header
	ContentLength    int64
	TransferEncoding []string
	Close            bool
	Trailer          http.Header
	TLS              *tls.ConnectionState

	// The response body and err returned when reading it.
	Body  []byte
	Error gobError
}

This object wraps an http.Response object in order to make it possible to gob encode it.

func NewGobResponse

func NewGobResponse(resp *http.Response) *GobResponse

This takes a Response object and returns a gob compatible GobResponse object.

Jump to

Keyboard shortcuts

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