Skip to content
This repository
  • 2 commits
  • 6 files changed
  • 0 comments
  • 1 contributor
2  action/Response.php
@@ -53,7 +53,7 @@ protected function _init() {
53 53 if ($config['location']) {
54 54 $classes = $this->_classes;
55 55 $location = $classes['router']::match($config['location'], $config['request']);
56   - $this->headers('location', $location);
  56 + $this->headers('Location', $location);
57 57 }
58 58 }
59 59
5 net/http/Request.php
@@ -36,7 +36,7 @@ class Request extends \lithium\net\http\Message {
36 36 *
37 37 * @var string
38 38 */
39   - public $method = 'GET';
  39 + public $method;
40 40
41 41 /**
42 42 * Cookies.
@@ -84,7 +84,8 @@ public function __construct(array $config = array()) {
84 84 'followLocation' => true
85 85 );
86 86 parent::__construct($config + $defaults);
87   - $this->method = $this->_config['method'];
  87 + $this->method = $this->method ?: $this->_config['method'];
  88 +
88 89 $this->headers = array(
89 90 'Host' => $this->port ? "{$this->host}:{$this->port}" : $this->host,
90 91 'Connection' => 'Close',
2  tests/cases/action/DispatcherTest.php
@@ -198,7 +198,7 @@ public function testCall() {
198 198
199 199 public function testAutoHandler() {
200 200 $result = MockDispatcher::run(new Request(array('url' => '/auto')));
201   - $this->assertEqual(array('location: /redirect'), $result->headers());
  201 + $this->assertEqual(array('Location: /redirect'), $result->headers());
202 202 }
203 203
204 204 public static function process($request) {
12 tests/cases/action/RequestTest.php
@@ -1076,6 +1076,18 @@ public function testConvertToUrl2() {
1076 1076 $expected = 'https://foo.com/the/base/path/posts?some=query&parameter=values';
1077 1077 $this->assertEqual($expected, $request->to('url'));
1078 1078 }
  1079 +
  1080 + /**
  1081 + * Tests that the HTTP request method set by `Request` from the server information is not
  1082 + * overwritten in a parent class.
  1083 + */
  1084 + public function testRequesMethodConfiguration() {
  1085 + $request = new Request(array('env' => array('REQUEST_METHOD' => 'POST')));
  1086 + $this->assertEqual('POST', $request->method);
  1087 +
  1088 + $request = new Request(array('env' => array('REQUEST_METHOD' => 'PATCH')));
  1089 + $this->assertEqual('PATCH', $request->method);
  1090 + }
1079 1091 }
1080 1092
1081 1093 ?>
2  tests/cases/action/ResponseTest.php
@@ -188,7 +188,7 @@ public function testLocationHeaderStatus() {
188 188 'classes' => array('router' => __CLASS__),
189 189 'location' => array('controller' => 'foo_bar', 'action' => 'index')
190 190 ));
191   - $this->assertEqual(array('location: /foo_bar'), $this->response->headers());
  191 + $this->assertEqual(array('Location: /foo_bar'), $this->response->headers());
192 192 }
193 193
194 194 public static function match($url) {
2  tests/cases/net/http/RouterTest.php
@@ -541,7 +541,7 @@ public function testRouteHandler() {
541 541 $result = Router::process(new Request(array('url' => '/users/login')));
542 542 $this->assertTrue($result instanceof Response);
543 543
544   - $headers = array('location' => '/login');
  544 + $headers = array('Location' => '/login');
545 545 $this->assertEqual($headers, $result->headers);
546 546 }
547 547

No commit comments for this range

Something went wrong with that request. Please try again.