Setup Environment
Install sdkman
curl -s "https://get.sdkman.io" | bash
From a new shell, run the following command:
sdk install java 17.0.9-oracle
sdk install scala 2.12.16
sdk install sbt 1.9.8
Run the following command:
docker run --rm -p 8080:80 kennethreitz/httpbin
And browse to http://localhost:8080. You should see the home page of HttpBin.
Exercise 1
- Send a GET request to
http://localhost:8080/base64/{base64_encoded}
- Example encoded message:
dmVsbyBpcyBhd2Vzb21lISEhISEK
- Print the decoded response
Exercise 2
- Send a GET request to
http://localhost:8080/redirect-to?url=http%3A%2F%2Flocalhost%3A8080%2Fuuid&status_code=200
- Mark the request to not follow redirects (
requets.followRedirects(false)
) - Parse the response
- Send another request according to the value in
Location
header
Exercise 3
- Send a GET request to
"http://localhost:8080/absolute-redirect/{N}"
- Mark the request to not follow redirects (
requets.followRedirects(false)
) - Parse the response
- Send another request according to the value in
Location
header - Repeat until status code is 200
- print the result JSON
Exercise 4
- Send a GET request to
localhost:8080/stream/{N}
- Parse the received JSON objects to collection of
HttpBinPayload