()
| 191 | } |
| 192 | |
| 193 | func (f clientCloser) Close() error { |
| 194 | stderr := f.r.stderr.Bytes() |
| 195 | if len(stderr) == 0 { |
| 196 | return f.rwc.Close() |
| 197 | } |
| 198 | |
| 199 | logLevel := zapcore.WarnLevel |
| 200 | if f.status >= 400 { |
| 201 | logLevel = zapcore.ErrorLevel |
| 202 | } |
| 203 | |
| 204 | if c := f.logger.Check(logLevel, "stderr"); c != nil { |
| 205 | c.Write(zap.ByteString("body", stderr)) |
| 206 | } |
| 207 | |
| 208 | return f.rwc.Close() |
| 209 | } |
| 210 | |
| 211 | // Request returns an HTTP response with header and body |
| 212 | // from the FastCGI responder. |