Skip to content

Commit

Permalink
http2/h2demo: flush headers earlier in demo /ECHO handler
Browse files Browse the repository at this point in the history
It confused somebody who thought things were hanging because they had
expected to see a response before they started streaming data.

Change-Id: If672956efde3756c966b0c88b9c15ed21daeccba
Reviewed-on: https://go-review.googlesource.com/125644
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
bradfitz committed Jul 24, 2018
1 parent 367449d commit 6a6df25
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions h2demo/h2demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ func echoCapitalHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "PUT required.", 400)
return
}
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
io.Copy(flushWriter{w}, capitalizeReader{r.Body})
}

Expand Down

0 comments on commit 6a6df25

Please sign in to comment.