reqpar

package
v0.0.0-...-b44964e Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestFile

type RequestFile struct {
	// Name of the temporary file in which contents are stored
	Filename string `json:"filename"`
	// Original filename used by the client
	OrigFilename string `json:"orig_filename"`
}

type RequestParams

type RequestParams struct {
	Values map[string][]string      `json:"values"`
	Files  map[string][]RequestFile `json:"files"`
}

RequestParams represents simplified HTTP form data: string values and files.

func New

func New(r *http.Request, tmpDir string, payloadLimit int64) (ret *RequestParams, err error)

New creates JSON-able RequestParams structure from the given http request. All form files are stored as temporary files, so the caller is responsible for cleaning those up, see RemoveFiles.

func (*RequestParams) FormFileName

func (rp *RequestParams) FormFileName(name string) string

FormFileName returns name of the temporary file

func (*RequestParams) FormValue

func (rp *RequestParams) FormValue(name string) string

func (*RequestParams) RemoveFiles

func (rp *RequestParams) RemoveFiles()

RemoveFiles removes all files saved as part of request params

Jump to

Keyboard shortcuts

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