- my ($status, $headers, $body) = @$ret;
- my %codes = (
- 200 => 'OK',
- 301 => 'Moved Permanently',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 501 => 'Not Implemented',
- );
+ if (ref($ret) eq 'CODE') {
+ $ret->(*dump_header);
+ } else {
+ my ($status, $headers, $body) = @$ret;
+
+ dump_header([$status, $headers])->write($body->[0]);
+ }
+}