# http://www.iana.org/assignments/media-types/application/gzip
$body->{hdr} = [ 'Content-Type', 'application/gzip' ];
$body->{fn} = $fn;
- my $hdr = $body->getline; # fill in Content-Disposition filename
+ # fill in Content-Disposition filename
+ my $hdr = $body->getline;
+ if ($body->{hdr}) {
+ return [ 404, ['Content-Type','text/plain'],
+ [ "No results found\n" ] ];
+ }
[ 200, $hdr, $body ];
}
my ($ctx) = @_;
my $q = PublicInbox::SearchQuery->new($ctx->{qp});
my $x = $q->{x};
+ require PublicInbox::Mbox;
return PublicInbox::Mbox::mbox_all($ctx, $q->{'q'}) if $x eq 'm';
sres_top_html($ctx);
}
$res = $cb->(GET('/test/?q=s:test&l=5e'));
is($res->code, 200, 'successful search result');
is_deeply([], $warn, 'no warnings from non-numeric comparison');
+
+ $res = $cb->(POST('/test/?q=s:bogus&x=m'));
+ is($res->code, 404, 'failed search result gives 404');
+ is_deeply([], $warn, 'no warnings');
});
done_testing();