HTTP Methods
Choose a method for a search form and explain why a delete action should not be a normal GET link.
Understand the topic
HTTP methods express the intended operation. GET retrieves a representation and should not perform requested state-changing actions. HEAD retrieves response metadata without a response body. POST submits processing, PUT replaces a target representation, PATCH applies partial changes, and DELETE requests removal. Method semantics do not replace authentication, authorization, input validation, or protections against forged requests.
Worked example
<table><caption>Common method intentions</caption><tr><th scope="col">Method</th><th scope="col">Typical purpose</th></tr><tr><td>GET</td><td>Retrieve data</td></tr><tr><td>HEAD</td><td>Retrieve metadata</td></tr><tr><td>POST</td><td>Submit data for processing</td></tr><tr><td>PUT</td><td>Replace a representation</td></tr><tr><td>PATCH</td><td>Apply partial changes</td></tr><tr><td>DELETE</td><td>Request removal</td></tr><tr><td>OPTIONS</td><td>Discover communication options</td></tr></table>
Ordinary HTML forms directly support GET and POST for network submission. Other methods are commonly used through JavaScript clients or server-side conventions.
Practice
Choose a method for a search form and explain why a delete action should not be a normal GET link.
Show a suggested answer
Use GET for a search. Deletion changes state, so a GET link is inappropriate and can be triggered by crawlers, previews, or prefetching.Common mistake
Do not assume POST automatically provides security or encryption. Validate the request and use HTTPS.