embed

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheControl

type CacheControl struct {
	MustRevalidate bool
	NoCache        bool
	NoStore        bool
	Public         bool
	Private        bool
	Immutable      bool
	MaxAge         *time.Duration
}

CacheControl represents a response's cache policy.

func NewCacheControl

func NewCacheControl(resp *http.Response) *CacheControl

NewCacheControl creates a new instance of CacheControl from related headers in the given HTTP response.

func (*CacheControl) Merge

func (c *CacheControl) Merge(o *CacheControl) *CacheControl

Merge merges 2 CacheControls.

func (*CacheControl) String

func (c *CacheControl) String() string

String generates CacheControl header value.

type Error

type Error struct {
	Type   string                 `json:"type"`
	Title  string                 `json:"title"`
	Status int                    `json:"status,omitempty"`
	Detail string                 `json:"detail,omitempty"`
	Links  map[string]interface{} `json:"_links,omitempty"`
}

Error represents an embedding error.

func NewMalformedJSONError

func NewMalformedJSONError(err error, uri fmt.Stringer) *Error

NewMalformedJSONError returns an error for an invalid response JSON.

func NewMalformedSubRequestError

func NewMalformedSubRequestError(err error, uri fmt.Stringer) *Error

NewMalformedSubRequestError returns an error for an invalid sub request.

func NewMalformedURLError

func NewMalformedURLError(err error) *Error

NewMalformedURLError returns an error for an invalid link URI.

func NewResponseBodyReadError

func NewResponseBodyReadError(err error, uri fmt.Stringer) *Error

NewResponseBodyReadError returns an error for a failed response body read.

func NewResponseError

func NewResponseError(resp *http.Response, uri fmt.Stringer) *Error

NewResponseError returns an error for a non-successful sub request response.

func NewRoundTripError

func NewRoundTripError(err error, uri fmt.Stringer) *Error

NewRoundTripError returns an error for a failed sub request round trip.

func (*Error) Error

func (e *Error) Error() string

type Transport

type Transport struct {
	http.RoundTripper
}

Transport is an embedding transport.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip fetches a response from the underlying transport and if it contains links matching the embedding spec, also fetches linked documents and embeds them.

Jump to

Keyboard shortcuts

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