Documentation
¶
Overview ¶
Package url provides URL value helpers exposed to WebGo programs.
Index ¶
- Constants
- Variables
- type Entry
- type URLSearchParams
- func (params *URLSearchParams) Append(key, value string) error
- func (params *URLSearchParams) Delete(key string)
- func (params *URLSearchParams) Encode() (string, error)
- func (params *URLSearchParams) Entries() []Entry
- func (params *URLSearchParams) Get(key string) (string, bool)
- func (params *URLSearchParams) GetAll(key string) []string
- func (params *URLSearchParams) Has(key string) bool
- func (params *URLSearchParams) Set(key, value string) error
Constants ¶
const MaxEncodedSize = 8 * 1024
MaxEncodedSize bounds both accepted query text and serialized output.
Variables ¶
var ( // ErrInvalidQuery reports malformed percent-encoding or invalid UTF-8. ErrInvalidQuery = errors.New("invalid URL query") // ErrQueryTooLarge reports a query that exceeds MaxEncodedSize. ErrQueryTooLarge = errors.New("URL query exceeds size limit") )
Functions ¶
This section is empty.
Types ¶
type URLSearchParams ¶
type URLSearchParams struct {
// contains filtered or unexported fields
}
URLSearchParams stores ordered query name/value pairs, including duplicate names and empty values.
func Parse ¶
func Parse(raw string) (*URLSearchParams, error)
Parse decodes an application/x-www-form-urlencoded query string.
func (*URLSearchParams) Append ¶
func (params *URLSearchParams) Append(key, value string) error
Append adds one value without removing existing values for key.
func (*URLSearchParams) Delete ¶
func (params *URLSearchParams) Delete(key string)
Delete removes every value for key.
func (*URLSearchParams) Encode ¶
func (params *URLSearchParams) Encode() (string, error)
Encode serializes params as application/x-www-form-urlencoded text.
func (*URLSearchParams) Entries ¶
func (params *URLSearchParams) Entries() []Entry
Entries returns a defensive copy in insertion order.
func (*URLSearchParams) Get ¶
func (params *URLSearchParams) Get(key string) (string, bool)
Get returns the first value for key.
func (*URLSearchParams) GetAll ¶
func (params *URLSearchParams) GetAll(key string) []string
GetAll returns all values for key in insertion order.
func (*URLSearchParams) Has ¶
func (params *URLSearchParams) Has(key string) bool
Has reports whether key has at least one value.
func (*URLSearchParams) Set ¶
func (params *URLSearchParams) Set(key, value string) error
Set replaces all values for key while retaining the first matching position.