cache

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPResponseToResponse

func HTTPResponseToResponse(res *http.Response) (*Response, *Request)

HTTPResponseToResponse transforms a giving response object into a Response object.

Types

type Cache

type Cache interface {
	Empty() error
	Delete(string) error
	AddData(string, []byte) error
	Add(string, *http.Response) error
	Get(string) (Request, Response, error)
	Serve(http.ResponseWriter, *http.Request) error
}

Cache defines a interface which exposes a cache like structure for retrieving requests.

type Request

type Request struct {
	Body      bytes.Buffer      `json:"body"`
	Method    string            `json:"method"`
	Path      string            `json:"path"`
	URL       *url.URL          `json:"url"`
	Headers   map[string]string `json:"headers"`
	Underline interface{}       `json:"underline"`
}

Request defines the structure which holds request fields for a given request.

func HTTPRequestToRequest

func HTTPRequestToRequest(req *http.Request) *Request

HTTPRequestToRequest transforms a giving request object into a cache.Request object.

type Response

type Response struct {
	Status    int               `json:"status"`
	Method    string            `json:"method"`
	Type      string            `json:"type"`
	Body      bytes.Buffer      `json:"body"`
	Headers   map[string]string `json:"headers"`
	Cookies   []string          `json:"cookies"`
	Underline interface{}       `json:"underline"`
}

Response defines a struct to hold a response for a giving resource.

type WebPair

type WebPair struct {
	Request  Request
	Response Response
}

WebPair defines a struct which contains the request object and response object received for that request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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