juju: github.com/juju/juju/apiserver/httpattachment Index | Files

package httpattachment

import "github.com/juju/juju/apiserver/httpattachment"

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

Package Files

attachment.go

func Get Uses

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 Uses

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.

Package httpattachment imports 10 packages (graph) and is imported by 46 packages. Updated 2018-06-28. Refresh now. Tools for package owners.