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
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