handlers

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MPL-2.0

README

Go HTTP Handlers

GoDoc Build Status

This repository contains HTTP middlewares that I use in my own Go projects. Feel free to use them too!

  • Compressor: Applies gzip compression to the response body, if the client supports it.
  • Logger: Logs HTTP requests, including: remote user, remote IP, latency, request id, txbytes, rxbytes, status, etc.
  • HTTP Method Override: Provides an alternative for clients that don't support methods other than POST or GET to override the HTTP method.
  • CSRF protection: Provides protection for endpoints from CSRF attacks.
  • Session: Secure cookie session management with external store support.
  • GRPCUtil: A convenient handler to initialize a gRPC server and OpenAPI proxy.

For examples on how to use these handlers, please refer to the Go documentation linked at the top.

Directories

Path Synopsis
Package compressor implements GZIP compression for HTTP responses.
Package compressor implements GZIP compression for HTTP responses.
Package csrf offers stateless protection against CSRF attacks using the HTTP Origin header and falling back to HMAC tokens stored on secured and HTTP-only cookies.
Package csrf offers stateless protection against CSRF attacks using the HTTP Origin header and falling back to HMAC tokens stored on secured and HTTP-only cookies.
Package grpcutil implements a gRPC HTTP handler and OpenAPI proxy.
Package grpcutil implements a gRPC HTTP handler and OpenAPI proxy.
cmd
Package main shows an example of gRPC handler usage.
Package main shows an example of gRPC handler usage.
Borrowed from https://github.com/codegangsta/negroni
Borrowed from https://github.com/codegangsta/negroni
Package logger allows logging HTTP requests using customized formats.
Package logger allows logging HTTP requests using customized formats.
Package methodoverride allows overriding the request's HTTP method by passing a hidden form field '_method' with another method as value.
Package methodoverride allows overriding the request's HTTP method by passing a hidden form field '_method' with another method as value.
Package session offers a HTTP handler to manage web sessions using encrypted and authenticated cookies as well as pluggable backing stores.
Package session offers a HTTP handler to manage web sessions using encrypted and authenticated cookies as well as pluggable backing stores.

Jump to

Keyboard shortcuts

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