HTTP

The language of the web: methods, status codes, headers and HTTP caching. What each part means, how to use it in real situations, and the classic traps (double submits, overly long caching, redirects).

  • 53 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Methods
  2. Status codes
  3. Headers
  4. HTTP caching

A few cards from the deck

  • GET: what is it?

    Show the answer

    The method that reads a resource without changing it

    It must have no side effects: caches, crawlers and prefetching may replay it.

  • A double click on “Order” creates two orders. Why?

    • The browser always duplicates GET requests
    • The order is sent with POST, which is not idempotent: each send creates an order
    • DNS resolved the address twice
    • The server cannot count to one
    Show the answer

    The order is sent with POST, which is not idempotent: each send creates an order

    Guard against it with an idempotency key sent with the order, and by disabling the button after the first click.

  • POST: what is it?

    Show the answer

    The method that submits data to create a resource or trigger an action

    It is not idempotent: sending it twice can create the same thing twice.

  • Which method to change only a profile's email address?

    • GET
    • DELETE
    • PATCH
    • PUT with only the email
    Show the answer

    PATCH

    PUT replaces the whole resource: sent with only the email, it would wipe the rest of the profile.