aboutsummaryrefslogtreecommitdiffstats
path: root/modules/httplib
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2018-01-30 23:09:16 +0100
committerLauris BH <lauris@nix.lv>2018-01-31 00:09:16 +0200
commitb3fd94c13d00f368dbd0f9414e699077ee4a6887 (patch)
treed6dacb844e486fa670f10bf61fac4ca3f18527a8 /modules/httplib
parentd09704e9032606654d07b03e1700474ca4d550e0 (diff)
downloadgitea-b3fd94c13d00f368dbd0f9414e699077ee4a6887.tar.gz
gitea-b3fd94c13d00f368dbd0f9414e699077ee4a6887.zip
Add sensitive headers (#3429)
* Add HeaderWithSensitiveCase methods to respect casing * Update webhook.go
Diffstat (limited to 'modules/httplib')
-rw-r--r--modules/httplib/httplib.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/httplib/httplib.go b/modules/httplib/httplib.go
index 88190704bb..c96e04c35f 100644
--- a/modules/httplib/httplib.go
+++ b/modules/httplib/httplib.go
@@ -164,6 +164,12 @@ func (r *Request) Header(key, value string) *Request {
return r
}
+// HeaderWithSensitiveCase add header item in request and keep the case of the header key.
+func (r *Request) HeaderWithSensitiveCase(key, value string) *Request {
+ r.req.Header[key] = []string{value}
+ return r
+}
+
// Headers returns headers in request.
func (r *Request) Headers() http.Header {
return r.req.Header