url

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(s string) string

func EscapeEx

func EscapeEx(s string, mode Encoding) string

func PathEscape

func PathEscape(s string) string

PathEscape escapes the string so it can be safely placed inside a URL path segment.

func PathUnescape

func PathUnescape(s string) (string, error)

PathUnescape does the inverse transformation of PathEscape, converting %AB into the byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.

PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).

func QueryEscape

func QueryEscape(s string) string

QueryEscape escapes the string so it can be safely placed inside a URL query.

func QueryUnescape

func QueryUnescape(s string) (string, error)

QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits.

func Unescape

func Unescape(s string) (string, error)

func UnescapeEx

func UnescapeEx(s string, mode Encoding) (string, error)

UnescapeEx unescapes a string; the mode specifies which section of the URL string is being unescaped.

Types

type Encoding

type Encoding int
const (
	EncodePath Encoding = 1 + iota
	EncodeUserPassword
	EncodeQueryComponent
	EncodeFragment
	EncodePathSegment
)

type EscapeError

type EscapeError string

func (EscapeError) Error

func (e EscapeError) Error() string

Jump to

Keyboard shortcuts

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