Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFoundRemote is used when no request is defined for a doctype ErrNotFoundRemote = errors.New("the doctype has no request defined") // ErrInvalidRequest is used when we can't use the request defined by the // developer ErrInvalidRequest = errors.New("the request is not valid") // ErrRequestFailed is used when the connexion to the remote website can't // be established ErrRequestFailed = errors.New("can't connect to the remote host") // ErrInvalidVariables is used when the variables can't be extracted from // the request ErrInvalidVariables = errors.New("the variables are not valid") // ErrMissingVar is used when trying to use a variable that has not been defined ErrMissingVar = errors.New("a variable is used in the template, but no value was given") // ErrInvalidContentType is used when the response has a content-type that // we deny for security reasons ErrInvalidContentType = errors.New("the content-type for the response is not authorized") // ErrRemoteAssetNotFound is used when the wanted remote asset is not part of // our defined list. ErrRemoteAssetNotFound = errors.New("wanted remote asset is not part of our asset list") )
Functions ¶
func ListDoctypes ¶
ListDoctypes returns the list of the known remote doctypes.
func ProxyRemoteAsset ¶
func ProxyRemoteAsset(name string, w http.ResponseWriter) error
ProxyRemoteAsset proxy the given http request to fetch an asset from our list of available asset list.
Types ¶
type CozyMetadata ¶
type CozyMetadata struct {
CreatedByApp string `json:"createdByApp,omitempty"`
}
type Doctype ¶
type Doctype struct { DocID string `json:"_id,omitempty"` DocRev string `json:"_rev,omitempty"` Request string `json:"request"` UpdatedAt time.Time `json:"updated_at"` }
Doctype is used to describe a doctype, its request for a remote doctype for example
type Remote ¶
type Remote struct { Doctype string Verb string URL *url.URL Headers map[string]string Body string }
Remote is the struct used to call a remote website for a doctype
func ParseRawRequest ¶
ParseRawRequest takes a string and parse it as a remote struct. First line is verb and URL. Then, we have the headers. And for a POST, we have a blank line, and then the body.
type Request ¶
type Request struct { DocID string `json:"_id,omitempty"` DocRev string `json:"_rev,omitempty"` RemoteDoctype string `json:"doctype"` Verb string `json:"verb"` URL string `json:"url"` ResponseCode int `json:"response_code"` ContentType string `json:"content_type"` Variables map[string]string `json:"variables"` CreatedAt time.Time `json:"created_at"` CozyMetadata CozyMetadata `json:"cozyMetadata"` }
Request is used to log in couchdb a call to a remote website
Click to show internal directories.
Click to hide internal directories.