protected function detectContentType($response)
    {
        if (!$this->contentTypeDetector) {
            return $this->defaultContentType;
        }

        if ($contentType = call_user_func($this->contentTypeDetector, $response, $this)) {
            return $contentType;
        }

        return $this->defaultContentType;
    }