Exemplo n.º 1
0
Arquivo: gzip.php Projeto: bmdevel/ezc
 public function testFilter()
 {
     $response = new ezcMvcResponse();
     $response->body = 'Ze Body';
     $filter = new ezcMvcGzipResponseFilter();
     $filter->filterResponse($response);
     self::assertSame('gzip', $response->content->encoding);
     self::assertSame(gzencode('Ze Body'), $response->body);
 }
Exemplo n.º 2
0
 function runResponseFilters(ezcMvcRoutingInformation $routeInfo, ezcMvcRequest $request, ezcMvcResult $result, ezcMvcResponse $response)
 {
     if (!ezcBase::inDevMode()) {
         if (in_array('gzip', $request->accept->encodings)) {
             $filter = new ezcMvcGzipResponseFilter();
             $filter->filterResponse($response);
         } else {
             if (in_array('deflate', $request->accept->encodings)) {
                 $filter = new ezcMvcGzDeflateResponseFilter();
                 $filter->filterResponse($response);
             }
         }
     }
 }