-
-
Notifications
You must be signed in to change notification settings - Fork 350
/
modify.go
24 lines (18 loc) · 816 Bytes
/
modify.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package proxy
import "net/http"
var (
nopReqModifier = func(req *http.Request) {}
nopResModifier = func(res *http.Response) error { return nil }
)
// RequestModifyFunc defines a type for a function that can modify a HTTP
// request before it's proxied.
type RequestModifyFunc func(req *http.Request)
// RequestModifyMiddleware defines a type for chaining request modifier
// middleware.
type RequestModifyMiddleware func(next RequestModifyFunc) RequestModifyFunc
// ResponseModifyFunc defines a type for a function that can modify a HTTP
// response before it's written back to the client.
type ResponseModifyFunc func(res *http.Response) error
// ResponseModifyMiddleware defines a type for chaining response modifier
// middleware.
type ResponseModifyMiddleware func(ResponseModifyFunc) ResponseModifyFunc