public function testSetAssociativeArray() { $bag = new HeaderBag(); $bag->set('foo', ['bad-assoc-index' => 'value']); $this->assertSame('value', $bag->get('foo')); $this->assertEquals(['value'], $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); $bag->set('foo', ['bar' => 'val'], false); $this->assertSame('value', $bag->get('foo')); $this->assertEquals(['value', 'val'], $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); }
/** * Is the response a redirect of some form? * * @param string $location * * @return bool */ public function isRedirect($location = null) { return in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location')); }