Blame view

middleware/main.go 529 Bytes
776b4c95b   Marko Tikvić   refactored middle...
1
2
3
4
  package middleware
  
  import (
  	"net/http"
776b4c95b   Marko Tikvić   refactored middle...
5
6
7
  )
  
  func Headers(h http.HandlerFunc) http.HandlerFunc {
b3f1275cd   Marko Tikvić   refactored middle...
8
  	return IgnoreOptionsRequests(ParseForm(h))
776b4c95b   Marko Tikvić   refactored middle...
9
10
11
  }
  
  func AuthOnly(roles string, h http.HandlerFunc) http.HandlerFunc {
b3f1275cd   Marko Tikvić   refactored middle...
12
  	return IgnoreOptionsRequests(ParseForm(Auth(roles, h)))
776b4c95b   Marko Tikvić   refactored middle...
13
14
15
  }
  
  func Full(roles string, h http.HandlerFunc) http.HandlerFunc {
b3f1275cd   Marko Tikvić   refactored middle...
16
  	return IgnoreOptionsRequests(ParseForm(LogTraffic(Auth(roles, h))))
776b4c95b   Marko Tikvić   refactored middle...
17
  }
b3f1275cd   Marko Tikvić   refactored middle...
18
19
  func LogTraffic(h http.HandlerFunc) http.HandlerFunc {
  	return IgnoreOptionsRequests(ParseForm(LogRequestAndResponse(h)))
776b4c95b   Marko Tikvić   refactored middle...
20
  }