I'm not very familiar with the HTTP-servlet standard, so perhaps http4s is technically in-the-right in assuming the ServletInputStream has not yet been read from. However, it would certainly make the library more user-friendly (and have saved me hours) if the BlockingServletIo raised something like an IllegalStateException -- including a pertinent error message -- if the input-stream's isFinished method returns true out-the-gate.
In my case, I had a javax.servlet.Filter registered that was calling getParameterMap on the HttpServletRequest (to do some primitive malicious-request rejection), before passing off the request object off to the http4s stack... It looks like this was invoking Jetty's implementation of getParameterMap, which reads "POST" parameters (so to speak) from the request body.
The result is that I would end up with an empty Map when doing something like req.decode[UrlForm] { f => val params = f.values; /* ... */ } and no sign of what had gone wrong.
I'm not very familiar with the HTTP-servlet standard, so perhaps http4s is technically in-the-right in assuming the
ServletInputStreamhas not yet been read from. However, it would certainly make the library more user-friendly (and have saved me hours) if theBlockingServletIoraised something like anIllegalStateException-- including a pertinent error message -- if the input-stream'sisFinishedmethod returnstrueout-the-gate.In my case, I had a
javax.servlet.Filterregistered that was callinggetParameterMapon theHttpServletRequest(to do some primitive malicious-request rejection), before passing off the request object off to the http4s stack... It looks like this was invoking Jetty's implementation ofgetParameterMap, which reads "POST" parameters (so to speak) from the request body.The result is that I would end up with an empty
Mapwhen doing something likereq.decode[UrlForm] { f => val params = f.values; /* ... */ }and no sign of what had gone wrong.