Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ruhe9126y@DeadInside Yes you can. But as far as I know (and please correct me if I'm wrong) you can not easily POST with a filled body
-
@ruhe from my knowledge, the body of a post request is composed by all the content (or parameters) it is carrying (the "data" in an ajax call). I'm not sure I understand what you mean by filled body either
-
@ruhe with jQuery it's something like:
var datuh = { "some" : "json" };
$.ajax({
type: "POST",
url: "/wherever",
contentType: 'application/json',
data: JSON.stringify(datuh),
success: function(resp) {
//yay
}
});
(Although of course, you http://youmightnotneedjquery.com) -
ruhe9126y@DeadInside that's exactly what I tried in my latest project. But then i noticed that the data is not passed to my backend as i expected. Instead, the json body was translated into x-www-form-urlencoded data and therefore the backend always received empty body POST requests. I later read an article about this problem which said that JQuery/Akax automatically translates such data into said x-www-form-urlencoded format.
Of course I could be wrong but that's what I experienced -
musician6656y@ruhe uhh just use fetch if you can or otherwise axios. Never had problems with post requests with those
-
J4s0n13336yNot always true in ever project. Also maybe there is a reason why he needs a GET. Or maybe he wants to stay with the standard and you did use the wrong method type.
To say I am done now eat it sucker is a very bad habbit for an Professional developer -
devios157016yThe natural order must be respected! The server is on a lower architectural level than a consuming application so it calls the shots.
The server determines the API, and the application consumes it. As it always has been. As it always shall be. Amen.
Ahem ahem.
*clears throat*
Front end bois, listen that carefully.
YOU DONT FUCKIN TELL THE BACKEND HOW TO ACCEPT REQUESTS.
Backend creates the fuckin methods, the parameters and the responses, AND YOU FUCKIN ADAPT TO IT.
This guy at my work, we are both from Uni but i picked backend because i suck at frontend and i like using backend languages, sends me a message and tells me he can't make the project work.
At this time i have almost finished my part, i have made the method, have checked that they work, and i closed the work computer.
And now he tells me he wants to make a GET request instead of POST. LISTEN HERE MOTHERFUCKER. The methods are ready, adapt to them and shut the fuck up.
And before you tell me some methods don't work, make fuckin sure your part is correct because if i boot up the work laptop again to check why the method you have told me doesn't work, and it still does the job it was intented to do but you can't fix your part, i will fuckin cut your throat.
Sucker.
I do my part, and have to study for uni exams, since you don't have to because you have passed them, do your self a favor and fuckin learn to do things.
It's not my fault that i got experience on my own while you were just only doing our uni retarded projects and didn't bother to learn anything on your own.
I don't mean by any needs that i'm better than you but fuckin accept that i have learned something else that you have not and i would like to share the knowledge with you since you didn't bother.
rant