Skip to content

Instantly share code, notes, and snippets.

@jbarrett
Created January 20, 2016 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbarrett/ff2baa93c7d3daf56946 to your computer and use it in GitHub Desktop.
Save jbarrett/ff2baa93c7d3daf56946 to your computer and use it in GitHub Desktop.
What were my request headers?
# plackup echo_headers.pl
use strict;
use warnings;
use Plack::Request;
use JSON;
my $app = sub {
my $req = Plack::Request->new(shift);
my $res = $req->new_response(200);
$res->body( JSON->new->pretty->encode( {
map { $_ => $req->env->{$_} }
grep { $_ =~ /^HTTP/ } keys %{ $req->env }
} ) );
$res->content_type('application/json');
$res->finalize;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment