...

Source file src/edge-infra.dev/pkg/edge/auth-proxy/transport.go

Documentation: edge-infra.dev/pkg/edge/auth-proxy

     1  package authproxy
     2  
     3  import (
     4  	"net/http"
     5  	"net/url"
     6  )
     7  
     8  type ProxyTransport struct {
     9  	url *url.URL
    10  	*http.Transport
    11  }
    12  
    13  func New(url *url.URL) *ProxyTransport {
    14  	return &ProxyTransport{url: url}
    15  }
    16  
    17  func (p *ProxyTransport) RoundTrip(r *http.Request) (*http.Response, error) {
    18  	r.URL = p.url
    19  	r.RequestURI = r.URL.String()
    20  	r.Host = p.url.Host
    21  	return http.DefaultTransport.RoundTrip(r)
    22  }
    23  

View as plain text