This week's book giveaway is in the Java in General forum.
We're giving away four copies of Java by Comparison (eBook) and have Simon Harrer, Jörg Lenhard, Linus Dietz on-line!
See this thread for details.
Win a copy of Java by Comparison (eBook) this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EPractice Lab review quiz 3 : Delete vs POST  RSS feed

 
Ranch Hand
Posts: 1639
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Which of the following HTTP methods is used to remove an article from a virtual shopping cart in a web application?
Given answer: POST



I think the answer should be DELETE, not POST.
 
Rancher
Posts: 784
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the assumption would be made that the virtual shopping cart has reserves into the stock, so there is a virtual hold on items. To remove these holds and free up the resources in the DB, you would need to do a post with instructions for a delete action. So in essence post a negative transaction.

Himai Minh wrote:


Which of the following HTTP methods is used to remove an article from a virtual shopping cart in a web application?
Given answer: POST



I think the answer should be DELETE, not POST.

 
Himai Minh
Ranch Hand
Posts: 1639
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the reason why POST is chosen instead of DELETE is because when DELETE is used, we have to provide the URI of the resource to be removed.
Since we don't know the URI of the items to be removed in this shopping cart application, we use POST to remove the item from the DB.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!