public function testGetMimeTypeJs() { $js = 'app.js'; $this->temp->create($js, '//javascript'); $a = new Asset($this->temp->getPathname($js)); $this->assertSame('application/javascript', $a->getMimeType()); }
public function serveAssetAction(Request $request, $asset_name) { try { $asset = new Asset($this->getAssetPath($asset_name)); //grab the regexps to test against from the config file for this asset $response = new Response(); $response->setContent($asset->getContent()); $response->headers->set('Content-Type', $asset->getMimeType()); $response->headers->set('X-Generated-By', get_class($this)); $response->headers->set('Content-Length', $asset->getContentLength()); return $response; } catch (\Exception $e) { return new Response($e->getMessage(), 404); } }