Bird
0
0

This DELETE request code returns 401 Unauthorized:

medium📝 Debug Q7 of 15
Rest API - HTTP Methods
This DELETE request code returns 401 Unauthorized:
fetch('/api/posts/7', { method: 'DELETE' })

What is the most probable cause?
AThe server is down
BThe resource does not exist
CMissing authentication or token in request headers
DDELETE method is not supported
Step-by-Step Solution
Solution:
  1. Step 1: Understand 401 Unauthorized

    401 means client must authenticate to access resource.
  2. Step 2: Identify cause in DELETE request

    Missing authentication headers cause 401 on protected DELETE endpoints.
  3. Final Answer:

    Missing authentication or token in request headers -> Option C
  4. Quick Check:

    401 = Authentication required [OK]
Quick Trick: 401 means authentication missing [OK]
Common Mistakes:
MISTAKES
  • Confusing 401 with 404
  • Assuming server down causes 401
  • Thinking DELETE unsupported causes 401

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes