2019-11-24 18:46:38 +00:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
var (
|
|
|
|
nopReqModifier = func(req *http.Request) {}
|
|
|
|
nopResModifier = func(res *http.Response) error { return nil }
|
|
|
|
)
|
|
|
|
|
2019-11-30 08:24:38 +00:00
|
|
|
// RequestModifyFunc defines a type for a function that can modify a HTTP
|
|
|
|
// request before it's proxied.
|
2019-11-24 18:46:38 +00:00
|
|
|
type RequestModifyFunc func(req *http.Request)
|
2019-11-30 08:24:38 +00:00
|
|
|
|
|
|
|
// 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.
|
2019-11-24 18:46:38 +00:00
|
|
|
type ResponseModifyFunc func(res *http.Response) error
|
2019-11-30 08:24:38 +00:00
|
|
|
|
|
|
|
// ResponseModifyMiddleware defines a type for chaining response modifier
|
|
|
|
// middleware.
|
|
|
|
type ResponseModifyMiddleware func(ResponseModifyFunc) ResponseModifyFunc
|