go fmt
This commit is contained in:
11
main.go
11
main.go
@@ -18,14 +18,13 @@ import (
|
||||
)
|
||||
|
||||
var myLDAP = LDAP{
|
||||
Host: "localhost",
|
||||
Port: 389,
|
||||
Host: "localhost",
|
||||
Port: 389,
|
||||
BaseDN: "dc=example,dc=com",
|
||||
}
|
||||
|
||||
|
||||
type ResponseWriterPrefix struct {
|
||||
real http.ResponseWriter
|
||||
real http.ResponseWriter
|
||||
prefix string
|
||||
}
|
||||
|
||||
@@ -35,7 +34,7 @@ func (r ResponseWriterPrefix) Header() http.Header {
|
||||
|
||||
func (r ResponseWriterPrefix) WriteHeader(s int) {
|
||||
if v, exists := r.real.Header()["Location"]; exists {
|
||||
r.real.Header().Set("Location", r.prefix + v[0])
|
||||
r.real.Header().Set("Location", r.prefix+v[0])
|
||||
}
|
||||
r.real.WriteHeader(s)
|
||||
}
|
||||
@@ -50,7 +49,7 @@ func StripPrefix(prefix string, h http.Handler) http.Handler {
|
||||
}
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if prefix != "/" && r.URL.Path == "/" {
|
||||
http.Redirect(w, r, prefix + "/", http.StatusFound)
|
||||
http.Redirect(w, r, prefix+"/", http.StatusFound)
|
||||
} else if p := strings.TrimPrefix(r.URL.Path, prefix); len(p) < len(r.URL.Path) {
|
||||
r2 := new(http.Request)
|
||||
*r2 = *r
|
||||
|
||||
Reference in New Issue
Block a user