diff options
author | Eric Wong <e@80x24.org> | 2016-06-30 09:13:21 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-06-30 09:13:21 +0000 |
commit | e158d56a54d3c6d4890aa6ac4caa28a834279af0 (patch) | |
tree | c65de54c3d94ac1216de5161550063db0b6c2803 /lib/PublicInbox/WwwStream.pm | |
parent | eb2de0cded427c055e17237c3e23801082beef79 (diff) | |
download | public-inbox-e158d56a54d3c6d4890aa6ac4caa28a834279af0.tar.gz |
This encapsulates an entire PSGI response array, hopefully making it easier to generate responses and avoid typos when setting the Content-Type.
Diffstat (limited to 'lib/PublicInbox/WwwStream.pm')
-rw-r--r-- | lib/PublicInbox/WwwStream.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index d2bf318b..6de1b310 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -14,6 +14,12 @@ sub new { bless { nr => 0, cb => $cb, ctx => $ctx }, $class; } +sub response { + my ($class, $ctx, $code, $cb) = @_; + [ $code, [ 'Content-Type', 'text/html; charset=UTF-8' ], + $class->new($ctx, $cb) ] +} + sub _html_top ($) { my ($self) = @_; my $ctx = $self->{ctx}; |