Fix #6231 - Accept chunked encoding on start

Fixed using the @sfitts solution

That also makes the function trivial to unit test without breaking into the internal APIs of the engine