request

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Overview

Package request implements a set of utilities and structures for handling HTTP requests.

The request package provides functionality for working with HTTP requests, including parsing and manipulating request data, performing common operations such as sending requests, and handling response data.

Index

Constants

View Source
const (
	GET       Method = http.MethodGet     // GET is the HTTP GET method.
	HEAD             = http.MethodHead    // HEAD is the HTTP HEAD method.
	POST             = http.MethodPost    // POST is the HTTP POST method.
	PUT              = http.MethodPut     // PUT is the HTTP PUT method.
	PATCH            = http.MethodPatch   // PATCH is the HTTP PATCH method.
	DELETE           = http.MethodDelete  // DELETE is the HTTP DELETE method.
	CONNECT          = http.MethodConnect // CONNECT is the HTTP CONNECT method.
	OPTIONS          = http.MethodOptions // OPTIONS is the HTTP OPTIONS method.
	TRACE            = http.MethodTrace   // TRACE is the HTTP TRACE method.
	ALL              = "ALL"              // ALL is representing as any HTTP method.
	UNDEFINED        = ""                 // UNDEFINED is undefined HTTP method.
)

Constants representing common HTTP methods.

These constants are of type Method and are assigned the values of the corresponding HTTP methods from the net/http package. Using these constants allows users of the request package to specify HTTP methods in a type-safe manner, rather than using raw strings.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element int

Element represents the different elements of a request that can be matched.

The Element type is used to specify which element of a request should be matched when analyzing the request for threats. It can be one of the following values:

  • URI: specifies the request URI (path and query parameters) as the element to match
  • Headers: specifies the request headers as the element to match
  • Body: specifies the request body as the element to match
const (
	// URI specifies the request URI (path and query parameters) as the request element to match.
	URI Element = iota

	// Headers specifies the request headers as the request element to match.
	Headers

	// Body specifies the request body as the request element to match.
	Body

	// Any specifies that any element of the request should be matched.
	Any
)

func ToElement added in v0.7.0

func ToElement(s string) Element

ToElement converts a string representation of an element to the corresponding Element value.

type Method

type Method string

Method is a type alias for string, used to represent HTTP methods.

It is defined as a type alias to allow for custom methods to be added in the future, while still maintaining type-safety.

func ToMethod added in v0.7.0

func ToMethod(s string) Method

ToMethod converts a string representation of a method to the corresponding Method value.

Jump to

Keyboard shortcuts

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