Web Requests - POST Flashcards
What is the main purpose of POST requests in web applications?
To transfer files or user parameters from the URL within the HTTP Request body
How does POST differ from GET in terms of data placement?
POST places user parameters within the HTTP Request body, while GET places them in the URL
What is one benefit of using POST requests regarding logging?
Lack of Logging: It avoids inefficient logging of large uploaded files as part of the requested URL
Why are there fewer encoding requirements for POST requests compared to GET requests?
POST places data in the body which can accept binary data, reducing the need for encoding
What is a limitation of URL length for GET requests?
Generally, a URL’s length should be kept to below 2,000 characters, limiting data transmission
What is a common use case for POST requests in web applications?
Submitting login forms
What command can be used to send a POST request with cURL?
curl -X POST -d ‘data’ http://<SERVER_IP>:<PORT>/</PORT></SERVER_IP>
What flag is used in cURL to follow redirection after authentication?
-L
What is the significance of the Set-Cookie header in HTTP responses?
It allows browsers to persist authentication without needing to log in each time
How can you view the response headers, including cookies, in cURL?
Use the -i or -v flags
What cURL flag is used to send a cookie with a request?
-b
How can you specify a cookie in a header using cURL?
curl -H ‘Cookie: cookie_name=cookie_value’ http://<SERVER_IP>:<PORT>/</PORT></SERVER_IP>
What kind of data format is used when sending POST data in a JSON request?
application/json
What command is used to replicate a POST request with JSON data using cURL?
curl -X POST -d ‘{“search”:”london”}’ -H ‘Content-Type: application/json’ http://<SERVER_IP>:<PORT>/search.php</PORT></SERVER_IP>
What is the expected response when correctly sending a search request for ‘london’?
[“London (UK)”]
What is one potential exercise to understand the impact of headers in requests?
Repeat the request without adding the cookie or content-type headers
What is the benefit of using cURL for web application assessments?
It allows for faster testing of web applications without interacting with the front-end
What method can be used to copy a request as Fetch in developer tools?
Right-click on the request and select Copy>Copy as Fetch