We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http.Flusher
http.ResponseWriter
sample.go
package main import ( "fmt" "net/http" "reflect" ) type responseWriter struct { http.ResponseWriter } func (w *responseWriter) Flush() { fmt.Println("Flushing...") if flusher, ok := w.ResponseWriter.(http.Flusher); ok { flusher.Flush() } } type dummy struct{} func (d *dummy) Header() http.Header { fmt.Println("Dummy Header") return nil } func (d *dummy) Write(data []byte) (int, error) { fmt.Println("Dummy Write ", data) return 0, nil } func (d *dummy) WriteHeader(responseCode int) { fmt.Println("Dummy WriteHeader ", responseCode) } func foo(rw http.ResponseWriter) { var respCodeOverrideWriter = &responseWriter{ResponseWriter: rw} var flusher http.Flusher = respCodeOverrideWriter fmt.Println("responseWriter is http.Flusher. We can call Flush manually:") flusher.Flush() var httpResponseWriter http.ResponseWriter = respCodeOverrideWriter _, ok := httpResponseWriter.(http.Flusher) fmt.Println("Is responseWriter http.Flusher?", ok) } func main() { foo(&dummy{}) }
responseWriter is http.Flusher. We can call Flush manually: Flushing... Is responseWriter http.Flusher? true
responseWriter is http.Flusher. We can call Flush manually: Flushing... Is responseWriter http.Flusher? false
v0.15.1
See this issue in the Traefik repo for context
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following program
sample.go
triggers an unexpected resultExpected result
Got
Yaegi Version
v0.15.1
Additional Notes
See this issue in the Traefik repo for context
The text was updated successfully, but these errors were encountered: