Skip to content

Commit 8e2f621

Browse files
committed
Adjust docs - remove "sent" word when referencing to responses
1 parent a66d9d6 commit 8e2f621

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

lib/Thunderhorse.pm

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,20 +401,20 @@ Return value of the destination sub is by default sent to the requestor as
401401
C<text/html> with status code C<200>. This is a common and handy shortcut, but
402402
it is equally easy to do something else. Take the following destination example:
403403
404-
async sub send_custom ($self, $ctx)
404+
async sub build_custom ($self, $ctx)
405405
{
406406
$ctx->res->text('Plaintext response');
407407
return 'this will not get rendered';
408408
}
409409
410-
This takes response (L<Thunderhorse::Response>) from context, and sends
411-
plaintext manually. This action I<consumes> the context, marking it as
410+
This takes response (L<Thunderhorse::Response>) from context, and sets
411+
plaintext body manually. This action I<consumes> the context, marking it as
412412
finished. In this case, return value of the destination is ignored.
413413
414414
415415
Another example:
416416
417-
sub send_custom2 ($self, $ctx)
417+
sub set_custom2 ($self, $ctx)
418418
{
419419
$ctx->res->content_type('text/plain');
420420
return 'this is rendered as plaintext';
@@ -536,10 +536,10 @@ bridge is created when you call C<add> on the result of another C<add>:
536536
537537
When C</admin/users> is requested, both C<check_admin> and C<list_users> will
538538
be called in sequence. The bridge destination receives the same arguments as
539-
regular destinations. If the bridge consumes the context (by sending a
540-
response), further matching stops. Otherwise, the next matching location is
541-
called. For this reason, bridge destinations should return C<undef> explicitly
542-
to avoid consuming the context by accident:
539+
regular destinations. If the bridge consumes the context, further matching
540+
stops. Otherwise, the next matching location is called. For this reason, bridge
541+
destinations should return C<undef> explicitly to avoid consuming the context
542+
by accident:
543543
544544
sub check_admin ($self, $ctx)
545545
{
@@ -1323,7 +1323,7 @@ This hook's method B<cannot be declared on a controller level>.
13231323
The C<on_error> hook is called when an exception occurs during request
13241324
processing.
13251325
1326-
This hook should consume the context by sending a response. The default handler
1326+
This hook should consume the context by setting a response. The default handler
13271327
calls L</render_error> method a text page with an error message.
13281328
13291329
=head3 Overriding system methods
@@ -1348,7 +1348,7 @@ following things:
13481348
13491349
=item * tries to set C<Content-Type> header to C<text/html> (if it was not set already)
13501350
1351-
=item * awaits sending C<$result> to the client using L<PAGI::Response/send> method (as text)
1351+
=item * sets C<$result> as the response body
13521352
13531353
=back
13541354
@@ -1360,11 +1360,12 @@ references and render them as JSON/YAML.
13601360
async sub render_error($self, $ctx, $code, $message = undef) { ... }
13611361
async sub render_error($self, $controller, $ctx, $code, $message = undef) { ... }
13621362
1363-
This method's default implementation sends a plain text response with code
1363+
This method's default implementation builds a plain text response with code
13641364
C<500>. The default implementation checks C<is_production> method of the
13651365
application to avoid rendering the original error message which may contain
13661366
sensitive information. It also acknowledges the existence of L<Gears::X::HTTP>,
1367-
which may change the error code to something else.
1367+
which may change the error code to something else. Original response is
1368+
discarded and a new one is built.
13681369
13691370
=head2 Performance tuning
13701371

0 commit comments

Comments
 (0)