Heheheh, actually forward contents

This commit is contained in:
Kelvin Ly (on the cloud) 2019-07-19 03:59:19 +00:00
parent 3d7ff03609
commit 324308f5d6
1 changed files with 9 additions and 1 deletions

10
main.go
View File

@ -308,7 +308,15 @@ func forwardRequest(port int, proxyScheme string) func(http.ResponseWriter, *htt
}
defer resp.Body.Close()
// legacy code
respHeaders := w.Header()
for h, val := range resp.Header {
respHeaders[h] = val
}
w.WriteHeader(resp.StatusCode)
_, err = io.Copy(w, resp.Body)
if err != nil {
log.Print("encountered error while forwarding copy : " + err.Error())
}
}
}