Flush headers when using wait=true and stream=true

A lot of http client will missbehave unless they get a direct
response, even when long-polling.