I changed the get riddle, get random riddle, and the add riddles functions. I had to add in the parameters to get the response needed. At first I forgot to add the params variable to the get random riddle function so it was not working but then later realized the issue. I added error codes that seemeed reasonable

1. One service I use regularly is spotify to listen to music. One feature is creating playlists with different amount of songs in them. One thing behind the scenes with HTTP requests could be with trying to add a song that already exists in a playlist, this would result in some message saying the song is already in the playlist. If the song is not in the playlist it gets added.
2. I will definitly say that I was thinking too much about the lab and ended up trying complicated things but in reality it was a simple fix. This makes me think more about my tech interactions as simpler than I would have expected. However with the errors I recieved it shows how much more there is behind that I didn't see. I was able to see what actually goes into coding an application.
This commit is contained in:
ambreenn
2026-02-18 11:34:19 -05:00
parent 30080f582a
commit 62cd82b9f9
5 changed files with 43 additions and 5 deletions

View File

@@ -7,7 +7,27 @@ 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.
Line 12 is related to the connection type, it can be useful to know the connection went through and didn't fail
Line 13 has something to do with size of the file, this can be useful for how much space it takes up
Line 14 is the coding language which is useful for the user to code into the files
Line 25 shows how many correct answers the users have guessed, this can be useful for assessing users on something or just collecting data
Line 28 is the ID of the riddle, this is helpful to edit the riddle or identify it when coding
## 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.
http -v post https://riddles.makingwithcode.org/new question="What have I got in my pocket?" answer="My precious"
HTTP/1.1 200 OK
http -v get https://riddles.makingwithcode.org/new question="What have I got in my pocket?" answer="My precious"
HTTP/1.1 405 Method Not Allowed
http -v post https://riddles.makingwithcode.org/new question="What have I got in my pocket?"
HTTP/1.1 400 Bad Request
http -v post https://riddles.makingwithcode.org question="What have I got in my pocket?" answer="My precious"
HTTP/1.1 404 Not Found