You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TASK-022: snake_case render_* overrides on http_resource
Pure rename. The nine virtual member functions on http_resource are
now snake_case to match the public API style established by TASK-001:
render_GET -> render_get
render_POST -> render_post
render_PUT -> render_put
render_DELETE -> render_delete
render_PATCH -> render_patch
render_OPTIONS -> render_options
render_HEAD -> render_head
render_CONNECT -> render_connect
render_TRACE -> render_trace
The default render(...) fallback signature is unchanged.
Decision: this PR keeps the existing std::shared_ptr<http_response>
return type. The action item that calls for "http_response by value"
is the architectural turf of TASK-036, which already lists the dispatch
flip (modded_request::dhrs, internal_error_page, the auth path,
deferred-response lifetime) in its own action items and references the
already-renamed snake_case names in its acceptance criteria. Pulling
the value-return cutover into TASK-022 would force a transitional
shim because TASK-025/027/031 (which TASK-036 also depends on) have
not landed yet. Rename now; flip return type in TASK-036.
No compatibility shim. v2.0 is a clean break (PRD-NAM-REQ-001, §3.7,
§4.4, TASK-042). Subclasses still using the old camelCase names will
silently produce non-overriding shadow methods - that is the user's
signal to read the migration guide.
Acceptance:
- grep -E 'render_[A-Z]' src/httpserver/*.hpp returns empty
- Wider sweep (src/, test/, examples/, README.md, doc/) returns empty
- All 32 testsuite entries pass under release build
- All 32 testsuite entries pass under --enable-debug (-Werror -Wextra)
- cpplint clean on changed files
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -561,14 +561,14 @@ Once a webserver is created, you can manage its execution through the following
561
561
The `http_resource` class represents a logical collection of HTTP methods that will be associated to a URL when registered on the webserver. The class is **designed for extension** and it is where most of your code should ideally live. When the webserver matches a request against a resource (see: [resource registration](#registering-resources)), the method correspondent to the one in the request (GET, POST, etc..) (see below) is called on the resource.
562
562
563
563
Given this, the `http_resource` class contains the following extensible methods (also called `handlers` or `render methods`):
564
-
*_**std::shared_ptr<http_response>** http_resource::render_GET(**const http_request&** req):_ Invoked on an HTTP GET request.
565
-
*_**std::shared_ptr<http_response>** http_resource::render_POST(**const http_request&** req):_ Invoked on an HTTP POST request.
566
-
*_**std::shared_ptr<http_response>** http_resource::render_PUT(**const http_request&** req):_ Invoked on an HTTP PUT request.
567
-
*_**std::shared_ptr<http_response>** http_resource::render_HEAD(**const http_request&** req):_ Invoked on an HTTP HEAD request.
568
-
*_**std::shared_ptr<http_response>** http_resource::render_DELETE(**const http_request&** req):_ Invoked on an HTTP DELETE request.
569
-
*_**std::shared_ptr<http_response>** http_resource::render_TRACE(**const http_request&** req):_ Invoked on an HTTP TRACE request.
570
-
*_**std::shared_ptr<http_response>** http_resource::render_OPTIONS(**const http_request&** req):_ Invoked on an HTTP OPTIONS request.
571
-
*_**std::shared_ptr<http_response>** http_resource::render_CONNECT(**const http_request&** req):_ Invoked on an HTTP CONNECT request.
564
+
*_**std::shared_ptr<http_response>** http_resource::render_get(**const http_request&** req):_ Invoked on an HTTP GET request.
565
+
*_**std::shared_ptr<http_response>** http_resource::render_post(**const http_request&** req):_ Invoked on an HTTP POST request.
566
+
*_**std::shared_ptr<http_response>** http_resource::render_put(**const http_request&** req):_ Invoked on an HTTP PUT request.
567
+
*_**std::shared_ptr<http_response>** http_resource::render_head(**const http_request&** req):_ Invoked on an HTTP HEAD request.
568
+
*_**std::shared_ptr<http_response>** http_resource::render_delete(**const http_request&** req):_ Invoked on an HTTP DELETE request.
569
+
*_**std::shared_ptr<http_response>** http_resource::render_trace(**const http_request&** req):_ Invoked on an HTTP TRACE request.
570
+
*_**std::shared_ptr<http_response>** http_resource::render_options(**const http_request&** req):_ Invoked on an HTTP OPTIONS request.
571
+
*_**std::shared_ptr<http_response>** http_resource::render_connect(**const http_request&** req):_ Invoked on an HTTP CONNECT request.
572
572
*_**std::shared_ptr<http_response>** http_resource::render(**const http_request&** req):_ Invoked as a backup method if the matching method is not implemented. It can be used whenever you want all the invocations on a URL to activate the same behavior regardless of the HTTP method requested. The default implementation of the `render` method returns an empty response with a `404`.
573
573
574
574
#### Example of implementation of render methods
@@ -579,7 +579,7 @@ Given this, the `http_resource` class contains the following extensible methods
0 commit comments