Knowledgebase

Understanding Request and Response Print

  • python, troubleshooting, errors, redirects, guide, howto, solution, zillionkinghost
  • 0

How web applications work.

WHAT A REQUEST CONTAINS

A method, indicating the intent A path Headers Sometimes a body, carrying submitted data

WHAT THE COMMON METHODS MEAN

Retrieving something Submitting something that changes state

WHY THAT DISTINCTION MATTERS

Retrieval should not change anything.

A link that deletes something is a design error, and it will be triggered by crawlers.

WHAT A RESPONSE CONTAINS

A status code Headers A body

WHAT STATUS CODES INDICATE

Success Redirection A problem with the request A problem on the server

WHY YOU SHOULD RETURN THE RIGHT ONE

Clients and tools behave according to it.

Returning success for a failure breaks everything downstream.

WHAT TO RETURN FOR A MISSING RESOURCE

The not-found status, not a success page saying nothing was found.

WHAT ROUTING DOES

Maps a path to the code handling it.

WHAT TO KEEP IN HANDLERS

As little logic as possible.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot