Documentation ¶
Overview ¶
Package httpattachment provides facilities for attaching a streaming blob of data and associated metadata to an HTTP API request, and for reading that blob on the server side.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(req *http.Request, metaResult interface{}) (io.ReadCloser, error)
Get extracts the attached file and its metadata from the multipart data in the request. The metadata is JSON-unmarshaled into the value pointed to by metaResult.
func NewBody ¶
func NewBody(attached io.ReadSeeker, meta interface{}, name string) (body io.ReadSeeker, contentType string, err error)
NewBody returns an HTTP request body and content type suitable for using to make an HTTP request containing the given attached body data and JSON-marshaled metadata.
The name parameter is used to identify the attached "file", so a filename is an appropriate value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.