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) {
}
func (s *sendDataResponseWriter) tryInject() bool {
if header := s.Header().Get(HeaderKey); header != "" {
s.Header().Del(HeaderKey)
for _, injecter := range s.injecters {
if injecter.Match(header) {
s.hijacked = true
injecter.Inject(s.rw, s.req, header)
return true
}
header := s.Header().Get(HeaderKey)
s.Header().Del(HeaderKey)
if header == "" {
return false
}
for _, injecter := range s.injecters {
if injecter.Match(header) {
s.hijacked = true
injecter.Inject(s.rw, s.req, header)
return true
}
}
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