Lesson 6.4

Method semantics - auto-HEAD, OPTIONS, and 405

The four cases App.handle must tell apart, the Allow header derivation, and the bodyless OPTIONS 204 hand-coded to the exact form a later chapter will formalize.

36 minsrc/request.js, src/app.js
  • Enumerate the four method cases and route each to the right response.
  • Derive the Allow header - registered methods, plus HEAD if GET, plus OPTIONS, sorted.
  • Synthesize a bodyless 204 for OPTIONS with no content-length line.
  • Suppress every HEAD body, wire auto-HEAD through GET, and answer 405 versus 404 correctly.
Locked

This chapter is part of the framework capstone. Chapters 1 and 2 are free to build - unlock the rest to keep going.

Unlock the depth