# http: ResponseWriter does not implement http.Flusher

- **ID:** `go/net-http-flusher-not-available`
- **Domain:** go
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Using http.Flusher on a ResponseWriter that wraps or replaces the original object, such as when using a custom middleware that doesn't preserve the Flusher interface.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Go 1.15 | active | — | — |
| Go 1.16 | active | — | — |
| Go 1.17 | active | — | — |
| Go 1.18 | active | — | — |
| Go 1.19 | active | — | — |
| Go 1.20 | active | — | — |
| Go 1.21 | active | — | — |
| Go 1.22 | active | — | — |
| Go 1.23 | active | — | — |

## Workarounds

1. **Implement Flusher interface in your custom ResponseWriter wrapper by embedding the original writer and forwarding Flush()** (95% success)
   ```
   Implement Flusher interface in your custom ResponseWriter wrapper by embedding the original writer and forwarding Flush()
   ```
2. **Use http.ResponseController from Go 1.20+ to enable flush without direct Flusher assertion** (90% success)
   ```
   Use http.ResponseController from Go 1.20+ to enable flush without direct Flusher assertion
   ```
3. **Avoid wrapping ResponseWriter if possible; modify the handler to flush via the original writer before wrapping** (80% success)
   ```
   Avoid wrapping ResponseWriter if possible; modify the handler to flush via the original writer before wrapping
   ```

## Dead Ends

- **** — The assertion fails because the wrapper replaces the original writer; you must assert on the wrapper. (85% fail)
- **** — The original writer supports Flusher, but the wrapper doesn't pass it through; pre-check doesn't help. (70% fail)
- **** — Flushing is critical for streaming responses; ignoring it breaks functionality like SSE or chunked transfer. (90% fail)
