The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Plack::Middleware::Inflater - Inflate gzipped PSGI requests

VERSION

version 0.001

SYNOPSIS

  use Plack::Builder;
  builder {
      enable 'Inflater', content_encoding => [qw/gzip deflate/];
      sub {
          my $request = Plack::Request->new(shift);
          my $response = $request->new_response(
              200,
              ['X-Request-Content-Length', $request->header('Content-Length'),
               'X-Request-Content', $request->content],
              'OK');
          return $response->finalize;
      };
  };

DESCRIPTION

This PSGI middleware inflates incoming gzipped requests before they hit your PSGI app. This only happens whenever the request's Content-Encoding header is one of the values specified in the content_encoding attribute, which defaults to ['gzip'].

This lets you send compressed requests, like this:

  curl --header 'Content-Encoding: gzip' --data-binary @foobar.gz http://...

SEE ALSO

Plack

AUTHOR

Fabrice Gabolde <fgabolde@weborama.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Weborama.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.