gin-wraphh icon indicating copy to clipboard operation
gin-wraphh copied to clipboard

A function for wrapping middlewares that take and return http.Handler objects for the gin framework

WrapHH GoDoc Build Status

Use this to wrap middleware that accepts and returns http.Handler objects for use in gin.

Created to look like these helper methods in gin:

  • https://godoc.org/github.com/gin-gonic/gin#WrapF
  • https://godoc.org/github.com/gin-gonic/gin#WrapH

Examples

See the test code. I have examples wrapping the NYT gzip library and NoSurf, a popular CSRF protection middleware for golang.

About

Based on this gist: https://gist.github.com/turtlemonvh/6cd23ef13e1e290717ef

License

MIT