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

Use an early return in senddata.tryInject

parent f9e11b15
...@@ -52,16 +52,20 @@ func (s *sendDataResponseWriter) WriteHeader(status int) { ...@@ -52,16 +52,20 @@ 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)
for _, injecter := range s.injecters { if header == "" {
if injecter.Match(header) { return false
s.hijacked = true }
injecter.Inject(s.rw, s.req, header)
return true for _, injecter := range s.injecters {
} if injecter.Match(header) {
s.hijacked = true
injecter.Inject(s.rw, s.req, header)
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