📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

When would you add retries to frontend API calls, and which requests must never be retried automatically?

Junior Coding Intermediate

🎯 Key points

  • Retry GET/HEAD freely; PUT/DELETE are idempotent but handle 404 on a repeated DELETE
  • Never auto-retry state-changing POST/PATCH without an idempotency key
  • Retry only network errors, 408, 429, 502-504
  • Exponential backoff with jitter; honour Retry-After
  • Don't retry 400/401/403/409
  • Cap attempts at 2-3

⏱ 30-second answer

Retry only idempotent requests: GET and HEAD are safe, PUT and DELETE are idempotent by definition (though a DELETE retry may return 404 the second time, so treat that as success). Retry on network errors, 408, 429 and 502–504, with exponential backoff and jitter, honouring Retry-After. Never blindly retry a POST or PATCH that creates or changes state unless the API supports an idempotency key header, or you risk duplicate orders or payments. Don't retry 4xx validation or auth errors. Cap attempts at 2–3 so a struggling backend isn't hammered.

🔍 What the interviewer is checking

Checks idempotency awareness from the client side

↩ Usually asked after

More in Web Basics

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me