in reply to AnyEvent::HTTPD::Request Dynamic Async Response
You can respond even later, as the code in delayed_2_example shows:
$httpd->reg_cb ( '/test' => sub { my ($httpd, $req) = @_; $t = AnyEvent->timer (after => 2, cb => sub { my $txt = "CPU info:\n\n" . `cat /proc/cpuinfo`; $req->respond ([200, "ok", { 'Content-Type' => 'text/plain' } +, $txt]); }); }, );
So you can't "respond" until you have a meaningful content type, but that's OK as you can delay your response.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: AnyEvent::HTTPD::Request Dynamic Async Response
by sectokia (Friar) on Jun 07, 2022 at 02:40 UTC |