httpattachment

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

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.

Jump to

Keyboard shortcuts

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