Understanding HTTP Methods and Status Codes

A comprehensive guide to HTTP methods and their status codes

Featured image



🎯 Overview

HTTP methods define how clients communicate with web servers. Let’s explore each method and their corresponding status codes.

graph TD; A[🌐 HTTP Request Methods] --> B[🔍 GET Request]; A --> C[📝 POST Request]; A --> D[📄 HEAD Request]; B --> B1[💡 Used when typing URL in browser]; B1 --> B2[📄 GET /cat.png]; B2 --> B3[📦 200 OK \n Content-Type: image/png]; B3 --> B4[🖼️ Display Cat Image]; C --> C1[📤 Submitting a form]; C1 --> C2[📝 POST /sign_up \n Content-Type: application/json]; C2 --> C3[📦 200 OK \n Content-Type: text/html]; C3 --> C4[📄 Display Sign-up Page]; D --> D1[🔄 Similar to GET but no response body]; D1 --> D2[📄 HEAD /cat.png]; D2 --> D3[📦 200 OK \n Content-Type: image/png]; D3 --> D4[❌ No image, only headers]; %% Explanation B -.-> E[📌 GET: Usually no request body]; C -.-> F[📌 POST: Usually sends data in request body]; E -.-> G[⚠️ GET doesn’t change server state]; F -.-> H[⚠️ POST can change server state];



🔍 HTTP Methods

📥 GET

📤 POST

👀 HEAD

📝 PUT

❌ DELETE

🔧 PATCH

ℹ️ OPTIONS

🔍 TRACE

🔌 CONNECT



📊 HTTP Status Codes

🔵 1xx (Informational)

🟢 2xx (Success)

🟡 3xx (Redirection)

🔴 4xx (Client Error)

🟣 5xx (Server Error)



📚 Reference