formpayload

package
v0.4.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// FormEncodingMultipart identifies multipart/form-data payloads.
	FormEncodingMultipart = "multipart/form-data"
	// FormEncodingURLEncoded identifies application/x-www-form-urlencoded payloads.
	FormEncodingURLEncoded = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func ContractData

func ContractData(form *FormData) ([]string, []map[string]any)

ContractData returns a metadata-only row view suitable for contract validation.

Types

type ContractField

type ContractField struct {
	Name string
	Type model.ContractFieldType
}

ContractField describes the contract shape derived from one or more form parts.

func ContractFields

func ContractFields(form *FormData) []ContractField

ContractFields summarizes form part names into contract fields.

type FormData

type FormData struct {
	Encoding  string      `json:"encoding,omitempty"`
	Fields    []FormField `json:"fields,omitempty"`
	Files     []FormFile  `json:"files,omitempty"`
	SizeBytes int64       `json:"size_bytes,omitempty"`
}

FormData carries runtime form fields and file parts while serializing only safe metadata.

func ParseMultipartFormBody

func ParseMultipartFormBody(contentType string, body []byte, maxMemory int64) (*FormData, error)

ParseMultipartFormBody converts a multipart/form-data HTTP body into payload metadata.

func ParseURLEncodedFormBody

func ParseURLEncodedFormBody(body []byte) (*FormData, error)

ParseURLEncodedFormBody converts a URL-encoded HTTP form body into payload metadata.

func (*FormData) Clone

func (data *FormData) Clone() *FormData

Clone returns a deep copy of form payload metadata and runtime-only values.

type FormField

type FormField struct {
	Name        string   `json:"name"`
	ContentType string   `json:"content_type,omitempty"`
	ValueCount  int      `json:"value_count,omitempty"`
	SizeBytes   int64    `json:"size_bytes,omitempty"`
	Sensitive   bool     `json:"sensitive,omitempty"`
	Values      []string `json:"-" yaml:"-"`
}

FormField describes one named scalar form field.

type FormFile

type FormFile struct {
	Name        string `json:"name"`
	Filename    string `json:"filename,omitempty"`
	ContentType string `json:"content_type,omitempty"`
	SizeBytes   int64  `json:"size_bytes,omitempty"`
	SHA256      string `json:"sha256,omitempty"`
	Content     []byte `json:"-" yaml:"-"`
}

FormFile describes one named file form part.

Jump to

Keyboard shortcuts

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