Files
lab_riddles/notes.md
mdecker62 6652f53f8c question 1. I regularly use Spotify to stream
music on my phone. One feature I like is the personalized playlist recommendations on the home screen. Behind the scenes, my device likely sends an HTTP GET request to Spotify’s servers asking for recommended tracks based on my listening history. The server processes this request, runs algorithms to select songs I might like, and sends back an HTTP response containing the playlist data in JSON format. My app then parses that response and displays the recommended songs for me to play instantly.

question 2. Yes, this lab made me realize that every app or website I use is constantly sending and receiving HTTP requests in the background. Even simple actions, like loading a playlist or checking the weather, involve multiple requests and responses I never notice. It makes me appreciate how much coordination happens behind the scenes to make technology feel instant and seamless.
2026-02-12 16:50:46 -05:00

100 lines
2.6 KiB
Markdown

# Request and response notes
## Checkpoint 1
Read the request and response shown on lines 1-32 of the lab. Choose
five lines from the request and/or the response. For each, make an inference
about the meaning of the line, and some situation in which it might be useful.
You are welcome to research the meanings of these headers, but it's also
fine to speculate for now.
Answers:
line: Connection: keep-alive
This line may mean to keep the webpage open until closed.
line: Date: Tue, 05 Mar 2024 00:25:26 GMT
The above line may mean the date in which you accessed the derver
line: "question": "Where do you get dragon milk?"
This could be the question in text on the webpage
Line: Content-Type: application/json
This could mean that the application is made by a user named json???
Server: nginx/1.22.0 (Ubuntu)
This may mean what the name of the server you accessed is called.
## Checkpoint 2
The goal of this checkpoint is to see what status codes you can get back from
the riddle server. Paste below several `http` requests and the status codes
they return.
BELOW I EXCLUDED THE ANSWEDR TO GET A 400 CODE
mattd@Decker:~/making_with_code/mwc2/unit1/lab_riddles$ http -v post https://riddles.makingwithcode.org/guess id=1
POST /guess HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 11
Content-Type: application/json
Host: riddles.makingwithcode.org
User-Agent: HTTPie/3.2.2
{
"id": "1"
}
HTTP/1.1 400 Bad Request
Connection: keep-alive
Content-Length: 51
Content-Type: application/json
Cross-Origin-Opener-Policy: same-origin
Date: Mon, 09 Feb 2026 15:50:39 GMT
Referrer-Policy: same-origin
Server: nginx/1.24.0 (Ubuntu)
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
{
"errors": {
"answer": [
"This field is required."
]
}
}
FOR EXAMPLE 2 I REMOVE THE S IN HTTPS
mattd@Decker:~/making_with_code/mwc2/unit1/lab_riddles$ http -v post http://riddles.makingwithcode.org/guess id=1 answer
="a short-legged cow"
POST /guess HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 43
Content-Type: application/json
Host: riddles.makingwithcode.org
User-Agent: HTTPie/3.2.2
{
"answer": "a short-legged cow",
"id": "1"
}
HTTP/1.1 301 Moved Permanently
Connection: keep-alive
Content-Length: 178
Content-Type: text/html
Date: Mon, 09 Feb 2026 15:52:51 GMT
Location: https://riddles.makingwithcode.org/guess
Server: nginx/1.24.0 (Ubuntu)
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.24.0 (Ubuntu)</center>
</body>
</html>