Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rpcme
Created February 26, 2015 11:45
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/16e712d9effbcf0593b9 to your computer and use it in GitHub Desktop.
Save rpcme/16e712d9effbcf0593b9 to your computer and use it in GitHub Desktop.
#! /usr/bin/env perl
use Mojolicious::Lite;
use Test::More;
use Test::Mojo;
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 $t = Test::Mojo->new;
$t->post_ok( '/' => form => { bin => { file => 'foo.ear' } } )
->status_is(200)
->content_like(qr/ct undef/);
done_testing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment