plz.el icon indicating copy to clipboard operation
plz.el copied to clipboard

plz.el support GET with body

Open vlnn opened this issue 1 year ago • 3 comments

It's not recommended practice, but GET requests could be used with non-empty body, and I happened to work with 3rd-party API that officially requests this. CURL works well with their example, but plz does not. My naive approach shown here https://github.com/vlnn/plz.el/commit/ad4725e9ad63d3909f866681ca85458e5f256914 but I have no clue how bad with approach is — for now it's my workaround. But for future, shouldn't GET support that?

vlnn avatar Mar 03 '24 11:03 vlnn

Hmm, well, I guess if curl allows it, we can do it. What do the RFCs say about this?

alphapapa avatar Mar 03 '24 14:03 alphapapa

`A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

The response to a GET request is cacheable; a cache MAY use it to satisfy subsequent GET and HEAD requests unless otherwise indicated by the Cache-Control header field (Section 5.2 of [RFC7234]).`

which does not restrict, but beware of usage the payload with GET.

Still, the MIGHT is very vague in RFC, same as OPTIONAL, so I guess this is very non-restrictive way to say "we don't like it, it may not work, but it's possible".

vlnn avatar Mar 03 '24 14:03 vlnn

Ok, well, if it's allowed, and if someone needs to do it, and curl can do it, I'm willing to merge a patch that does it. :)

alphapapa avatar Mar 03 '24 15:03 alphapapa