Documentation ¶
Index ¶
- Constants
- func CreateBadRequestResponse(w http.ResponseWriter, err error)
- func CreateCreatedResponse(w http.ResponseWriter, data interface{})
- func CreateCustomStatusCodeResponse(statusCode int, w http.ResponseWriter, data interface{})
- func CreateInternalServerErrorResponse(w http.ResponseWriter, err error)
- func CreateNoContentResponse(w http.ResponseWriter)
- func CreateNotFoundResponse(w http.ResponseWriter, err error)
- func CreateSuccessResponse(w http.ResponseWriter, data interface{})
- func CreateTooManyRequestsResponse(w http.ResponseWriter, err error)
- func GetCurrentRoute(r *http.Request) string
- func GetRequestRealIp(r *http.Request) string
- func GetRequestUsername(r *http.Request) string
- func GetUserAgent(r *http.Request) string
- func SanitizeRequest(request map[string]interface{}, ignore []string) map[string]interface{}
Constants ¶
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 GetRequestRealIp ¶ added in v1.0.19
func GetRequestUsername ¶ added in v1.0.19
func GetUserAgent ¶ added in v1.0.19
func SanitizeRequest ¶ added in v1.0.32
SanitizeRequest Sanitiza a request, substituindo tags html pelas suas entidades
Types ¶
This section is empty.