commit
						aa3de8fd4f
					
				|  | @ -103,20 +103,22 @@ func GetRequestID(ctx Context) string { | ||||||
| // WithResponseWriter returns a new context and response writer that makes
 | // WithResponseWriter returns a new context and response writer that makes
 | ||||||
| // interesting response statistics available within the context.
 | // interesting response statistics available within the context.
 | ||||||
| func WithResponseWriter(ctx Context, w http.ResponseWriter) (Context, http.ResponseWriter) { | func WithResponseWriter(ctx Context, w http.ResponseWriter) (Context, http.ResponseWriter) { | ||||||
| 	irw := instrumentedResponseWriter{ |  | ||||||
| 		ResponseWriter: w, |  | ||||||
| 		Context:        ctx, |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if closeNotifier, ok := w.(http.CloseNotifier); ok { | 	if closeNotifier, ok := w.(http.CloseNotifier); ok { | ||||||
| 		irwCN := &instrumentedResponseWriterCN{ | 		irwCN := &instrumentedResponseWriterCN{ | ||||||
| 			instrumentedResponseWriter: irw, | 			instrumentedResponseWriter: instrumentedResponseWriter{ | ||||||
| 			CloseNotifier:              closeNotifier, | 				ResponseWriter: w, | ||||||
|  | 				Context:        ctx, | ||||||
|  | 			}, | ||||||
|  | 			CloseNotifier: closeNotifier, | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		return irwCN, irwCN | 		return irwCN, irwCN | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	irw := instrumentedResponseWriter{ | ||||||
|  | 		ResponseWriter: w, | ||||||
|  | 		Context:        ctx, | ||||||
|  | 	} | ||||||
| 	return &irw, &irw | 	return &irw, &irw | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue