httpbulb

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 13 Imported by: 0

README

httpbulb

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthHandle added in v0.3.0

func BasicAuthHandle(w http.ResponseWriter, r *http.Request)

func BrotliHandle added in v0.2.0

func BrotliHandle(w http.ResponseWriter, r *http.Request)

BrotliHandle is the handler that returns a response compressed with brotli

func CookiesHandle added in v0.4.0

func CookiesHandle(w http.ResponseWriter, r *http.Request)

CookiesHandle returns the cookies list, sent by the client

func DeflateHandle added in v0.2.0

func DeflateHandle(w http.ResponseWriter, r *http.Request)

DeflateHandle is the handler that returns a response compressed with zlib

func DelayHandle added in v0.3.0

func DelayHandle(w http.ResponseWriter, r *http.Request)

DelayHandle returns the same response as the MethodsHandle, but with a delay

func DeleteCookiesHandle added in v0.4.0

func DeleteCookiesHandle(w http.ResponseWriter, r *http.Request)

DeleteCookiesHandle deletes the cookies passed in the query parameters, then redirects to /cookies

func GzipHandle added in v0.2.0

func GzipHandle(w http.ResponseWriter, r *http.Request)

GzipHandle is the handler that returns a response compressed with gzip

func HeadersHandle added in v0.1.1

func HeadersHandle(w http.ResponseWriter, r *http.Request)

func IpHandle added in v0.1.1

func IpHandle(w http.ResponseWriter, r *http.Request)

func JsonError

func JsonError(w http.ResponseWriter, err string, code int)

func MethodsHandle added in v0.1.1

func MethodsHandle(w http.ResponseWriter, r *http.Request)

MethodsHandle is the basic handler for the methods endpoint (GET, POST, PUT, PATCH, DELETE)

func NewRouter

func NewRouter() *chi.Mux

func RobotsHandle added in v0.2.0

func RobotsHandle(w http.ResponseWriter, r *http.Request)

func SetCookieHandle added in v0.4.0

func SetCookieHandle(w http.ResponseWriter, r *http.Request)

SetCookieHandle sets a cookie with the name and value passed in the URL path, then redirects to /cookies

func SetCookiesHandle added in v0.4.0

func SetCookiesHandle(w http.ResponseWriter, r *http.Request)

SetCookiesHandle sets the cookies passed from the query parameters, then redirects to /cookies

func StreamNMessagesHandle added in v0.3.0

func StreamNMessagesHandle(w http.ResponseWriter, r *http.Request)

StreamNMessagesHandle streams N json messages

func UserAgentHandle added in v0.1.1

func UserAgentHandle(w http.ResponseWriter, r *http.Request)

Types

type AuthResponse added in v0.3.0

type AuthResponse struct {
	Authenticated bool   `json:"authenticated"`
	User          string `json:"user"`
}

AuthResponse is the response for the basic-auth endpoint

type CookiesResponse added in v0.4.0

type CookiesResponse struct {
	Cookies map[string][]string `json:"cookies"`
}

type HeadersResponse added in v0.1.1

type HeadersResponse struct {
	Headers http.Header `json:"headers"`
}

HeadersResponse is the response for the headers endpoint

type IpResponse added in v0.1.1

type IpResponse struct {
	Origin string `json:"origin"`
}

IpResponse is the response for the ip endpoint

type MethodsResponse

type MethodsResponse struct {
	// Args is a map of query parameters
	Args map[string][]string `json:"args"`
	// Data is the raw body of the request
	Data string `json:"data"`
	// Files is a map of files sent in the request
	Files map[string][]string `json:"files"`
	// Form is a map of form values sent in the request
	Form map[string][]string `json:"form"`
	// Headers is a map of headers sent in the request
	Headers map[string][]string `json:"headers"`
	// JSON is the parsed JSON body of the request
	JSON interface{} `json:"json"`
	// Origin is the IP address of the requester
	Origin string `json:"origin"`
	// URL is the full URL of the request
	URL string `json:"url"`
	// Gzipped is true if the request was compressed with gzip
	Gzipped bool `json:"gzipped,omitempty"`
	// Brotli is true if the request was compressed with brotli
	Brotli bool `json:"brotli,omitempty"`
	// Deflated is true if the request was compressed with zlib
	Deflated bool `json:"deflated,omitempty"`
}

MethodsResponse is the response for the methods endpoint

type StatusResponse added in v0.1.1

type StatusResponse struct {
	StatusText string `json:"status_text"`
}

StatusResponse is the response for the status endpoint

type StreamResponse added in v0.3.0

type StreamResponse struct {
	// ID is the ID of the message
	ID int `json:"id"`
	// Args is a map of query parameters
	Args map[string][]string `json:"args"`
	// Data is the raw body of the request
	Headers map[string][]string `json:"headers"`
	// Origin is the IP address of the requester
	Origin string `json:"origin"`
	// URL is the full URL of the request
	URL string `json:"url"`
}

StreamResponse represents a response for the stream endpoint

type UserAgentResponse added in v0.1.1

type UserAgentResponse struct {
	UserAgent string `json:"user-agent"`
}

UserAgentResponse is the response for the user-agent endpoint

Jump to

Keyboard shortcuts

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