Skip to content

Instantly share code, notes, and snippets.

@rpcme
Created February 26, 2015 12:15
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 rpcme/0e24773bf94b530df601 to your computer and use it in GitHub Desktop.
Save rpcme/0e24773bf94b530df601 to your computer and use it in GitHub Desktop.
#! /usr/bin/env perl
use Mojolicious::Lite;
use Test::More;
use Test::Mojo;
use File::MimeInfo;
post '/' => sub {
my $self = shift;
my $ct = $self->req->upload('bin')->headers->content_type;
my $out = defined $ct ? $ct : "ct undef";
$self->render(text => $out);
};
my $ear_type = mimetype('foo.ear');
my $t = Test::Mojo->new;
$t->post_ok( '/' => form => { bin => { file => 'foo.ear',
'Content-Type' => $ear_type } } )
->status_is(200)
->content_like(qr|application/octet-stream|);
done_testing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment