>_ IzzyLab

Hands-on task

This task is step 3 of the course “curl and HTTP APIs”

Find out the response code

medium~5 min

Find out which HTTP code the server returns for a request to http://localhost:8080/missing, and write just that number to /root/code.txt.

What you'll practise:
  • http codes
  • curl
  • curl -w
  • http_code
  • response status

Topic breakdown

Every HTTP response starts with a status line containing a numeric code: 2xx — success, 3xx — redirect, 4xx — client error (including 404 for a non-existent resource), 5xx — server error. The response body and the status code are different things: you can grab just the response metadata without saving the body itself. curl can print request characteristics in a formatted way via placeholder templates, and separately control what to do with the body.

What's checked

  1. the correct response code is written

What it looks like