RT 4.2.11, ticket#13852
[freeside.git] / rt / t / data / plugins / RT-Extension-PSGIWrap / lib / RT / Extension / PSGIWrap.pm
diff --git a/rt/t/data/plugins/RT-Extension-PSGIWrap/lib/RT/Extension/PSGIWrap.pm b/rt/t/data/plugins/RT-Extension-PSGIWrap/lib/RT/Extension/PSGIWrap.pm
new file mode 100644 (file)
index 0000000..1d0a55e
--- /dev/null
@@ -0,0 +1,16 @@
+package RT::Extension::PSGIWrap;
+
+use base 'Plack::Middleware';
+
+sub call {
+    my ( $self, $env ) = @_;
+    my $res = $self->app->($env);
+    return $self->response_cb( $res, sub {
+        my $headers = shift->[1];
+        Plack::Util::header_set($headers, 'X-RT-PSGIWrap' => '1');
+    } );
+}
+
+sub PSGIWrap { return shift->wrap(@_) }
+
+1;