When to Use GET vs POST
When you don't think about the basics of development day to day, you tend to forget the how and the whys and just get in a pattern of doing. Then when you think about they why, or are asked about the why, you may not have a "definition" at the ready.
Take for example the two common HTTP methods GET and POST when communicating between a client and a server. When should you favor one over the other?
Now that we know the basics of what differentiates GET and POST, we can now go over these rules for when (or when not) to use one versus the other.
Rule 1
Use GET for save actions (retrieving data) Use POST for unsafe actions (inserting or editing data)
Rule 2
Use POST when dealing with sensitive data
Rule 3
Use POST when dealing with long requests
The max URL length limit is 2048. This affects GET (point 4 on the GET graphic above)
Rule 4
Use GET in Ajax environments.
XMLHttpRequests implement POST as a 2 step process (sending headers first then data). Thus, GET requests are more responsive.
Take for example the two common HTTP methods GET and POST when communicating between a client and a server. When should you favor one over the other?
Now that we know the basics of what differentiates GET and POST, we can now go over these rules for when (or when not) to use one versus the other.
Rule 1
Use GET for save actions (retrieving data) Use POST for unsafe actions (inserting or editing data)
Rule 2
Use POST when dealing with sensitive data
Rule 3
Use POST when dealing with long requests
The max URL length limit is 2048. This affects GET (point 4 on the GET graphic above)
Rule 4
Use GET in Ajax environments.
XMLHttpRequests implement POST as a 2 step process (sending headers first then data). Thus, GET requests are more responsive.
Great Article
ReplyDeleteReact Based Projects for Final Year Students
FInal Year Project Centers in Chennai
JavaScript Training in Chennai
JavaScript Training in Chennai
Jammy Robinson: Poker for free online | Casino - JTM Hub
ReplyDeleteJammy 남원 출장샵 Robinson is a new Poker Room with a brand new 창원 출장샵 Poker Room 광명 출장안마 with all the 김천 출장안마 latest tournaments and tournaments from the Jammy 군포 출장샵 Gaming Poker community.