NAME

Thunderhorse::Response - Response wrapper for Thunderhorse

SYNOPSIS

async sub show ($self, $ctx, $id)
{
	await $ctx->res->text("Hello World");
	await $ctx->res->json({data => 'value'});
	await $ctx->res->redirect('/login');
}

DESCRIPTION

Thunderhorse::Response is a thin wrapper around PAGI::Response that integrates with Thunderhorse::Context. It provides a fluent interface for building and sending HTTP responses, including JSON, HTML, redirects, and file downloads.

This class extends PAGI::Response and mixes in Thunderhorse::Message to provide context integration.

INTERFACE

Inherits all interface from PAGI::Response, and adds the interface documented below.

Attributes

context

The Thunderhorse::Context object for this request (weakened).

Required in the constructor

Methods

new

$object = $class->new(%args)

Standard Mooish constructor. Consult "Attributes" section for available constructor arguments.

update

$res->update()

Updates the internal PAGI scope and sender from the context's PAGI tuple. Called automatically when the context's PAGI tuple changes via setter of "pagi" in Thunderhorse::Context.

SEE ALSO

Thunderhorse, PAGI::Response, Thunderhorse::Context