ghproxy/proxy/reqheader.go
2025-04-24 17:50:18 +08:00

17 lines
379 B
Go

package proxy
import (
"net/http"
"github.com/cloudwego/hertz/pkg/app"
)
func setRequestHeaders(c *app.RequestContext, req *http.Request) {
c.Request.Header.VisitAll(func(key, value []byte) {
headerKey := string(key)
headerValue := string(value)
if _, shouldRemove := reqHeadersToRemove[headerKey]; !shouldRemove {
req.Header.Set(headerKey, headerValue)
}
})
}