if ($type eq 'blob') {
$type = git_blob_mime_type($self, $req, $cat, \$buf, \$left);
} elsif ($type eq 'commit' || $type eq 'tag') {
- $type = 'text/plain';
+ $type = 'text/plain; charset=UTF-8';
} else {
$type = 'application/octet-stream';
}
return;
}
$$left -= $r;
- (index($buf, "\0") < 0) ? 'text/plain' : 'application/octet-stream';
+ (index($buf, "\0") < 0) ? 'text/plain; charset=UTF-8'
+ : 'application/octet-stream';
}
sub git_blob_stream_response {
return unless (defined $n && $n > 0);
sub {
my ($res) = @_; # Plack callback
- my $fh = $res->([200, ['Content-Type' => 'text/plain']]);
+ my $fh = $res->([200, [
+ 'Content-Type' => 'text/plain; charset=UTF-8']]);
$fh->write($buf);
while (1) {
$n = read($fp, $buf, 8192);
$req = 'http://example.com/test.git/plain/foo.txt';
my $blob = $cb->(GET($req));
- is($blob->header('Content-Type'), 'text/plain', 'got text/plain blob');
+ like($blob->header('Content-Type'), qr!\Atext/plain\b!,
+ 'got text/plain blob');
is($blob->content, "-----\nhello\nworld\n", 'raw blob passed');
});