You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-15 00:15:00 +02:00
Move responceCode out of HandleFunc.
This commit is contained in:
@ -209,12 +209,13 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy {
|
|||||||
proxy := NewWebSocketOrRestReverseProxy(u, opts, auth)
|
proxy := NewWebSocketOrRestReverseProxy(u, opts, auth)
|
||||||
serveMux.Handle(path, proxy)
|
serveMux.Handle(path, proxy)
|
||||||
case "static":
|
case "static":
|
||||||
|
responseCode, err := strconv.Atoi(host)
|
||||||
|
if err != nil {
|
||||||
|
logger.Printf("unable to convert %q to int, use default \"200\"", host)
|
||||||
|
responseCode = 200
|
||||||
|
}
|
||||||
|
|
||||||
serveMux.HandleFunc(path, func(rw http.ResponseWriter, req *http.Request) {
|
serveMux.HandleFunc(path, func(rw http.ResponseWriter, req *http.Request) {
|
||||||
responseCode, err := strconv.Atoi(host)
|
|
||||||
if err != nil {
|
|
||||||
logger.Printf("unable to convert %q to int, use default \"200\"", host)
|
|
||||||
responseCode = 200
|
|
||||||
}
|
|
||||||
rw.WriteHeader(responseCode)
|
rw.WriteHeader(responseCode)
|
||||||
fmt.Fprintf(rw, "Authenticated")
|
fmt.Fprintf(rw, "Authenticated")
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user