forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed support/http/server package files
- Loading branch information
Showing
5 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package http | ||
|
||
import ( | ||
stdhttp "net/http" | ||
"strings" | ||
) | ||
|
||
// HeadersMiddleware sends headers | ||
func HeadersMiddleware(headers stdhttp.Header, ignoredPrefixes ...string) func(next stdhttp.Handler) stdhttp.Handler { | ||
return func(next stdhttp.Handler) stdhttp.Handler { | ||
fn := func(w stdhttp.ResponseWriter, r *stdhttp.Request) { | ||
// Do not change ignored prefixes | ||
for _, prefix := range ignoredPrefixes { | ||
if strings.HasPrefix(r.URL.Path, prefix) { | ||
next.ServeHTTP(w, r) | ||
return | ||
} | ||
} | ||
|
||
headers.Write(w) | ||
next.ServeHTTP(w, r) | ||
} | ||
return stdhttp.HandlerFunc(fn) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters