body

package
v0.0.0-...-c95b20b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingFormName error = errors.New("Missing form name.")
	InvalidJSONPart error = errors.New("Invalid JSON part.")
)

Functions

func IsMultipartRequest

func IsMultipartRequest(contentType string) (bool, string)

IsMultipartRequest returns true if the Content-Type header suggests a multipart-encoded body. This is a utility method: ParseMultipartBody should only be called if this method returns true. Along with the boolean, this method returns the boundary string.

func ParseMultipartBody

func ParseMultipartBody(f io.Reader, boundary string) ([]string, []*certs.Certificate, error)

ParseMultipartBody takes a single HTTP request body that has been identified as being multipart and parses it according to what mkcert expects. In this case, the expectation is that there will be at least one part that contains a JSON-serialized list of labels, as with the normal upload, as well as zero-or-more PEM files, each containing one-or-more x509 certificates.

This function returns the slice of labels in the first element, the slice of parsed PEM certificates in the second, and an error in the third. If an error is encountered no data is read.

Types

This section is empty.

Jump to

Keyboard shortcuts

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