本文整理汇总了PHP中Magento\Framework\App\Response\Http::getHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::getHeader方法的具体用法?PHP Http::getHeader怎么用?PHP Http::getHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Response\Http
的用法示例。
在下文中一共展示了Http::getHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRepresentJson
/**
* Test setting body in JSON format
*/
public function testRepresentJson()
{
$this->model->setHeader('Content-Type', 'text/javascript');
$this->model->representJson('json_string');
$this->assertEquals('application/json', $this->model->getHeader('Content-Type')->getFieldValue());
$this->assertEquals('json_string', $this->model->getBody('default'));
}
示例2: addDebugHeaders
/**
* Set cache control
*
* @param ResponseHttp $result
* @return ResponseHttp
*/
protected function addDebugHeaders(ResponseHttp $result)
{
$cacheControl = $result->getHeader('Cache-Control')->getFieldValue();
$this->addDebugHeader($result, 'X-Magento-Cache-Control', $cacheControl);
$this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'MISS', true);
return $result;
}
示例3: addDebugHeaders
/**
* Set cache control
*
* @param ResponseHttp $result
* @return ResponseHttp
*/
protected function addDebugHeaders(ResponseHttp $result)
{
$cacheControlHeader = $result->getHeader('Cache-Control');
if ($cacheControlHeader instanceof \Zend\Http\Header\HeaderInterface) {
$this->addDebugHeader($result, 'X-Magento-Cache-Control', $cacheControlHeader->getFieldValue());
}
$this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'MISS', true);
return $result;
}
示例4: testSetXFrameOptions
public function testSetXFrameOptions()
{
$value = 'DENY';
$this->model->setXFrameOptions($value);
$this->assertSame($value, $this->model->getHeader(Http::HEADER_X_FRAME_OPT)->getFieldValue());
}
示例5: assertHeaderNotPresent
protected function assertHeaderNotPresent($name)
{
$this->interceptedResponse->sendResponse();
$this->assertFalse($this->interceptedResponse->getHeader($name));
}
示例6: getHeader
/**
* {@inheritdoc}
*/
public function getHeader($name)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'getHeader');
if (!$pluginInfo) {
return parent::getHeader($name);
} else {
return $this->___callPlugins('getHeader', func_get_args(), $pluginInfo);
}
}