@@ -116,7 +116,11 @@ runResponse ref res = do
116116 let add y = atomicModifyIORef refBuilder $ \x -> (x `mappend` y, ())
117117 withBody $ \body -> body add (return ())
118118 builder <- readIORef refBuilder
119− writeIORef ref $ SResponse s h $ toLazyByteString builder
119+ let lbs = toLazyByteString builder
120+ len = L.length lbs
121+ -- Force evaluation of the body to have exceptions thrown at the right
122+ -- time.
123+ seq len $ writeIORef ref $ SResponse s h $ toLazyByteString builder
120124 return ResponseReceived
121125 where
122126 (s, h, withBody) = responseToStream res