Hacker News new | ask | show | jobs
by amdelamar 1622 days ago
A year ago I had a coworker build a CRUD app with an API that required GET with a body. Something simple like:

    GET /api/query
    Host: example.org
    Content-Type: application/json
    
    {
      "a": "valueWith$pecialChars",
      "b": "valueWith$pecialChars",
      "limit": 100
    }
It worked fine for him because he used curl, which allows GET with a body. But I was using Paw (similar to Postman) which refused to send it. I mentioned the issue to him to which the reply was along the lines of "its a non issue, just use curl". I kid you not, 1 week after this coworker left for another job I fixed the service to accept POST requests.

If QUERY was around I'm sure I could've made a stronger case to fix it sooner.

2 comments

> required GET with a body

Elasticsearch also encourages GET with body. But a request payload is undefined, according to the RFC:

   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.
I’ve never accepted GET with a body but I’ve been burned several times using curl to test APIs. curl and browsers are very different beasts.