http

package
v1.0.41 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeHeaderKey                = "Content-Type"
	ApplicationJsonHeaderValue          = "application/json"
	CustomRealIpHeaderKey               = "X-Real-Ip"
	CustomForwardedForKey               = "X-Forwarded-For"
	CustomOriginEnvironmentHeaderKey    = "X-Origin-Environment"
	CustomCredentialUsernameHeaderKey   = "X-Credential-Username"
	CustomConsumerUsernameHeaderKey     = "X-Consumer-Username"
	CustomAppFirstAccessHeaderKey       = "X-App-First-Access"
	CustomI18nLanguageHeaderKey         = "X-I18n-Language"
	CloudflairIpCountryHeaderKey        = "Cf-Ipcountry"
	AuthorizationHeaderKey              = "Authorization"
	ErrorParsingDataToBytesErrorMessage = "error parsing data interface to bytes array, %s"
	EmptyRequestObjectErrorMessage      = "no request object was set to get %s"
)

Variables

This section is empty.

Functions

func CreateBadRequestResponse

func CreateBadRequestResponse(w http.ResponseWriter, err error)

CreateBadRequestResponse cria uma resposta com HTTP status code 400 e envia o erro no atributo body

func CreateCreatedResponse

func CreateCreatedResponse(w http.ResponseWriter, data interface{})

CreateCreatedResponse cria uma resposta com HTTP status code 201 e envia dados no atributo body

func CreateCustomStatusCodeResponse

func CreateCustomStatusCodeResponse(statusCode int, w http.ResponseWriter, data interface{})

CreateCustomStatusCodeResponse cria uma resposta com o código de status http recebido e envia os dados no atributo body

func CreateInternalServerErrorResponse

func CreateInternalServerErrorResponse(w http.ResponseWriter, err error)

CreateInternalServerErrorResponse cria uma resposta com HTTP status code 500 e envia o erro no atributo body

func CreateNoContentResponse

func CreateNoContentResponse(w http.ResponseWriter)

CreateNoContentResponse cria uma resposta com HTTP status code 203 e não envia dados no atributo body

func CreateNotFoundResponse added in v1.0.12

func CreateNotFoundResponse(w http.ResponseWriter, err error)

CreateNotFoundResponse cria uma resposta com HTTP status code 404 e envia o erro no atributo body

func CreateSuccessResponse

func CreateSuccessResponse(w http.ResponseWriter, data interface{})

CreateSuccessResponse cria uma resposta com HTTP status code 500 e envia os dados no atributo body

func CreateTooManyRequestsResponse

func CreateTooManyRequestsResponse(w http.ResponseWriter, err error)

CreateTooManyRequestsResponse creates a response with 429 HTTP status code

func GetCurrentRoute added in v1.0.19

func GetCurrentRoute(r *http.Request) string

func GetRequestRealIp added in v1.0.19

func GetRequestRealIp(r *http.Request) string

func GetRequestUsername added in v1.0.19

func GetRequestUsername(r *http.Request) string

func GetUserAgent added in v1.0.19

func GetUserAgent(r *http.Request) string

func SanitizeRequest added in v1.0.32

func SanitizeRequest(request map[string]interface{}, ignore []string) map[string]interface{}

SanitizeRequest Sanitiza a request, substituindo tags html pelas suas entidades

Types

This section is empty.

Jump to

Keyboard shortcuts

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