/** * @param ConnectionResponse $response * @return string */ public function getRawObfuscatedResponse(ConnectionResponse $response) { $rawObfuscatedResponse = ''; $responseHeaders = $response->getHeaders(); if ($responseHeaders) { $rawObfuscatedResponse .= implode(PHP_EOL, $this->httpHeaderHelper->generateRawHeaders($this->headerObfuscator->obfuscateHeaders($responseHeaders))); } $responseBody = $response->getBody(); if (strlen($responseBody) > 0) { $rawObfuscatedResponse .= PHP_EOL . PHP_EOL . $this->bodyObfuscator->obfuscateBody($response->getHeaderValue('Content-Type'), $responseBody); } return $rawObfuscatedResponse; }
/** * @dataProvider headerObfuscatorProvider * @param string[] $headers * @param string[] $obfuscatedHeaders */ public function testHeaderObfuscator($headers, $obfuscatedHeaders) { $headerObfuscator = new HeaderObfuscator(); $this->assertEquals($obfuscatedHeaders, $headerObfuscator->obfuscateHeaders($headers)); }