http

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MethodNames is a map of Method to string.
	MethodNames = map[Method]string{
		MethodGet:     "GET",
		MethodHead:    "HEAD",
		MethodPost:    "POST",
		MethodPut:     "PUT",
		MethodDelete:  "DELETE",
		MethodConnect: "CONNECT",
		MethodOptions: "OPTIONS",
		MethodTrace:   "TRACE",
		MethodPatch:   "PATCH",
	}

	// ErrMethodInvalid is returned if the HTTP method is invalid.
	ErrMethodInvalid = errors.New("invalid method")
)

Functions

This section is empty.

Types

type Method

type Method uint8

Method defines an HTTP method.

const (
	MethodInvalid Method = iota //
	MethodGet                   // RFC 7231, 4.3.1
	MethodHead                  // RFC 7231, 4.3.2
	MethodPost                  // RFC 7231, 4.3.3
	MethodPut                   // RFC 7231, 4.3.4
	MethodDelete                // RFC 7231, 4.3.5
	MethodConnect               // RFC 7231, 4.3.6
	MethodOptions               // RFC 7231, 4.3.7
	MethodTrace                 // RFC 7231, 4.3.8
	MethodPatch                 // RFC 5789
)

Common HTTP methods, these are defined in RFC 7231 section 4.3.

func MustParseMethod

func MustParseMethod(name string) Method

MustParseMethod parses method string or panics.

func ParseMethod

func ParseMethod(name string) Method

ParseMethod parses method string.

func (Method) MarshalJSON

func (m Method) MarshalJSON() ([]byte, error)

MarshalJSON method to json

func (Method) String

func (m Method) String() string

String method to string

func (*Method) UnmarshalJSON

func (m *Method) UnmarshalJSON(b []byte) error

UnmarshalJSON method from json

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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