Commit 85e6cbf8 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use an early return in senddata.tryInject

parent f9e11b15
...@@ -52,8 +52,12 @@ func (s *sendDataResponseWriter) WriteHeader(status int) { ...@@ -52,8 +52,12 @@ func (s *sendDataResponseWriter) WriteHeader(status int) {
} }
func (s *sendDataResponseWriter) tryInject() bool { func (s *sendDataResponseWriter) tryInject() bool {
if header := s.Header().Get(HeaderKey); header != "" { header := s.Header().Get(HeaderKey)
s.Header().Del(HeaderKey) s.Header().Del(HeaderKey)
if header == "" {
return false
}
for _, injecter := range s.injecters { for _, injecter := range s.injecters {
if injecter.Match(header) { if injecter.Match(header) {
s.hijacked = true s.hijacked = true
...@@ -61,7 +65,7 @@ func (s *sendDataResponseWriter) tryInject() bool { ...@@ -61,7 +65,7 @@ func (s *sendDataResponseWriter) tryInject() bool {
return true return true
} }
} }
}
return false return false
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment