5
h4xx3r
4y

GET Requests with a BODY as a payload are legit and stop living in denial!
TALKING TO YOU ANGULAR!

I'm fucking sick of seeing ignorant people(on SO or GitHub) coming up with the generic advice, on HTTP GET issues with having a BODY as a payload, to don't do that or you shouldn't, yadayadayada.

It's not a fucking issue at all in general, because as RFC-7231(https://tools.ietf.org/html/...) sais:
"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."

So, if your fucking server can't handle them(aka living in the past), [rest] in peace and suck it up!
(ps, I happen to use modern servers)

But why should you limit a fucking front-end framework(ex. Angular) in the first plate to being able to send such requests?!
It's a moronic limitation and the person or team responsible for it are at least clueless and as far the issue has reappeared through time, for how old is Angular, they didn't move an inch.

Comments
  • 1
    Just curious, what kind of data do you usually place in the GET request's body?
  • 2
    @molaram I guess I'll clarify what I meant. What kind and size of data do you need to send to the server via GET that can't go in as a query string?
  • 2
    @MrCSharp long ass amount of filters for example, browsers have also limitations on how long a query string can be, if your point is about putting everything in query parameters, have fun with when it doesn't work because of browsers
  • 0
    Its the age old problem. Is search a GET or a POST.
  • 1
    Ok but why don't use POST?
  • 2
    Excuse me, what the actual fuck

    This is literally the purpose of a POST?!
  • 5
    @PrivateGER Depends

    In most descriptions GET is far fetching data with no side effects and POST is for creating data.

    With this definition, if you need to send large filters to a search that do not change the state of the server, you should use GET and if the query string is to small, use a payload.

    So I agree with OP that switching to POST for a search is wrong as it implies that you expect side effects.
  • 0
    So what kind of search filters do you have that exceeds the 2MB url length limit on Chrome and 2048 characters on Firefox and IE?
  • 2
    @Voxera @nitwhiz @PrivateGER I would also add that it's up to the context to choose between GET and POST, some calls make more sense if they are GET even with body, some calls make more sense as POST.
  • 1
    @Voxera that makes sense. I hate that it makes sense.
  • 1
    @MrCSharp I can see a complex odata query with subselections growing ;)

    It’s not necessarily a good question ;)

    But it is possible.
  • 0
    Is there a way to have a JavaScript-less HTML5 form use GET with a fixed payload and still have all the other fields in the URL query string?
    That would allow to add CSRF prevention tokens to GET forms while still keeping them linkable (the server would generate the prefilled form when the token is missing).
  • 0
    @Voxera complex OAuth and OpenId info, tokens, signatures + custom application state gets passed in GET requests via URLs. I reckon if the global authentication and authorization standards are using query strings for that, search can use it too. I'm finding it hard to beleive you'd need even 1MB of filters for a search endpoint.

    I'm not arguing in bad faith here as I am very netrual to this argument. I haven't spoken to someone who holds your opinion so i am trying to understand it more.
  • 1
    @MrCSharp well, the query string is in reality limited to 2000-4000 chars due to browser limits, not 1Mbyte.

    And I also think that most usage will fit within this limit, but I just took some example that could potentially be to much.
Add Comment