Documentation
¶
Overview ¶
Package http is the HTTP output of docflow: the kind http, shown as HTTP (push), sends what reaches the node to a web service in a request (a downloader is where applications fetch documents instead). A program that imports the package has the kind; docflow/io/notify posts its webhooks with Do.
The node's URL expands {{meta.<key>}} (each value URL-escaped), its Method is POST (the default) or PUT, and its Headers expand {{meta.<key>}} too, without line breaks. Its credential is the request's Authorization: a token sent as Bearer, or a whole value with its scheme ("Basic …"). Its Body is how the request carries the document and the sender's metadata:
- direct (the default): the document is the body, as it is, its name in Content-Disposition, and the metadata goes along as X-Meta-<key> headers (2026-10-21).
- multipart: the body is multipart/form-data, the metadata a JSON object in the part meta, then the document in the part file, with its name and type (2026-10-23).
Another docflow's uploader (POST /api/upload/<node>, with its key or an app's token as the credential) takes either as its sender's: .bdf goes to another site as it is, with its name and metadata.
Every request has an Idempotency-Key, the delivery's id, the same on every try (a send is at least once). 2xx is done; 408, 429 and 5xx are tried again; any other answer, a redirect too, fails for good.
Index ¶
Constants ¶
const ( // BodyDirect sends the document as the body, the metadata in // X-Meta-* headers. BodyDirect = "direct" // BodyMultipart sends multipart/form-data: the metadata as JSON in // the part meta, the document in the part file. BodyMultipart = "multipart" )
The ways a request carries the document (Node.Body).
const KindHTTP = "http"
KindHTTP is the kind of the HTTP output.
Variables ¶
var Client = &nethttp.Client{Timeout: 2 * time.Minute, CheckRedirect: func(*nethttp.Request, []*nethttp.Request) error { return nethttp.ErrUseLastResponse }}
Client makes the requests (tests set their own). It follows no redirect.