protected function getRequestReader($contentType, $readerType) { // find best reader type if ($readerType === null) { $reader = $this->readerFactory->getReaderByContentType($contentType); } else { $reader = $this->readerFactory->getReaderByInstance($readerType); } if ($reader === null) { $reader = $this->readerFactory->getDefaultReader(); // @TODO the correct response would be to throw an unsupported // content type exception since this would enforce clients to send // an correct content type //throw new UnsupportedMediaTypeException('Unsupported content type', 415); } return $reader; }
public function testGetDefaultReader() { $this->assertInstanceOf('PSX\\Data\\Reader\\Json', $this->readerFactory->getDefaultReader()); }