On 14/02/17 23:46, Shing Wai Chan wrote:
> According section 8.2 of RFC 7540, a promised request must be cacheable and safe without a request body.
I think it is worth repeating this and/or referencing it in the Javadoc
for PushBuilder.
> For request methods defined in RFC 7231, only GET and HEAD are cacheable and safe.
> So, one cannot push
> POST, PUT, DELETE, CONNECT, OPTIONS and TRACE. (*)
> Since there are custom http methods, there may be others cacheable and safe methods,
>
> In PushBuilder#method, what will happen when methods in (*) are applied?
Either we allow them and the client should reset the stream oe we block
them e.g. with IAE as suggested below.
> The current javadoc seems to accept the methods in (*) above.
> Should we throw IllegalArgumentException in this case?
Tricky. I don't like allowing something we know to be wrong but neither
do I like the inconsistency that custom methods would always be allowed.
On balance, I prefer an IAE for known invalid methods here.
Mark