Bird
0
0

Which of the following is the correct syntax to access the X-RateLimit-Reset header in a JavaScript fetch response object named response?

easy📝 Syntax Q3 of 15
Rest API - Rate Limiting and Throttling
Which of the following is the correct syntax to access the X-RateLimit-Reset header in a JavaScript fetch response object named response?
Aresponse.get('X-RateLimit-Reset')
Bresponse.getHeader('X-RateLimit-Reset')
Cresponse.headers['X-RateLimit-Reset']
Dresponse.headers.get('X-RateLimit-Reset')
Step-by-Step Solution
Solution:
  1. Step 1: Recall fetch API header access method

    In fetch, headers are accessed with headers.get('header-name').
  2. Step 2: Check other options for correctness

    response.getHeader and response.get do not exist; headers['name'] is not valid for Headers object.
  3. Final Answer:

    response.headers.get('X-RateLimit-Reset') -> Option D
  4. Quick Check:

    fetch headers use headers.get('name') [OK]
Quick Trick: Use headers.get('Header-Name') to read fetch response headers [OK]
Common Mistakes:
  • Using incorrect method names
  • Trying to access headers as object properties
  • Confusing fetch headers with Node.js headers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes