Fix newResponse function in tests
Flush response body on regular interval