|
|
@ -131,7 +131,14 @@ func (proxy *Proxy) ServeHTTP(res http.ResponseWriter, req *http.Request) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logErr(log, err)
|
|
|
|
logErr(log, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if response.Body != nil && len(response.Body) > 0 {
|
|
|
|
}
|
|
|
|
|
|
|
|
if response.BodyReader != nil {
|
|
|
|
|
|
|
|
_, err := io.Copy(res, response.BodyReader)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
logErr(log, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if response.Body != nil && len(response.Body) > 0 {
|
|
|
|
_, err := res.Write(response.Body)
|
|
|
|
_, err := res.Write(response.Body)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
logErr(log, err)
|
|
|
|
logErr(log, err)
|
|
|
@ -189,6 +196,9 @@ func (proxy *Proxy) ServeHTTP(res http.ResponseWriter, req *http.Request) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, addon := range proxy.Addons {
|
|
|
|
|
|
|
|
reqBody = addon.StreamRequestModifier(f, reqBody)
|
|
|
|
|
|
|
|
}
|
|
|
|
proxyReq, err := http.NewRequest(f.Request.Method, f.Request.URL.String(), reqBody)
|
|
|
|
proxyReq, err := http.NewRequest(f.Request.Method, f.Request.URL.String(), reqBody)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Error(err)
|
|
|
|
log.Error(err)
|
|
|
@ -247,6 +257,9 @@ func (proxy *Proxy) ServeHTTP(res http.ResponseWriter, req *http.Request) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, addon := range proxy.Addons {
|
|
|
|
|
|
|
|
resBody = addon.StreamResponseModifier(f, resBody)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
reply(f.Response, resBody)
|
|
|
|
reply(f.Response, resBody)
|
|
|
|
}
|
|
|
|
}
|
|
|
|