Also provide the correct mime type to speed up the parsing.

This commit is contained in:
Colin Kuskie 2015-02-18 13:43:40 -05:00
parent df56936e59
commit 6028535303

View file

@ -51,7 +51,14 @@ sub handler {
my $requestedUrl = $session->url->getRequestedUrl;
##If they requested some snippet that doesn't exist any longer, then just
##return an empty string instead of generating the whole not found page.
if ($requestedUrl =~ /\.(?:js|css)$/) {
my $wants_js = $requestedUrl =~ /\.js$/;
my $wants_css = $requestedUrl =~ /\.css$/;
if ($wants_js) {
$session->http->setMimeType('text/javascript');
return '';
}
elsif ($wants_js) {
$session->http->setMimeType('text/css');
return '';
}
my $notFound = WebGUI::Asset->getNotFound($session);