This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1414use function Facebook\AutoloadMap\Generated\is_dev ;
1515
1616abstract class BaseRouter <+TResponder > {
17+ public function __construct (
18+ private RouterOptions $options = shape (' head_rewrite' => true )
19+ ) {}
20+
1721 abstract protected function getRoutes (
1822 ): ImmMap <HttpMethod , ImmMap <string , TResponder >>;
1923
@@ -33,7 +37,7 @@ final public function routeMethodAndPath(
3337 }
3438
3539 if (
36- $method === HttpMethod :: HEAD && $allowed === keyset [HttpMethod :: GET ]
40+ $this -> options [ ' head_rewrite ' ] && $ method === HttpMethod :: HEAD && $allowed === keyset [HttpMethod :: GET ]
3741 ) {
3842 list ($responder , $data ) = $resolver -> resolve(HttpMethod :: GET , $path );
3943 $data = Dict \map ($data , $value ==> \urldecode ($value ));
Original file line number Diff line number Diff line change 1+ < ?hh // strict
2+
3+ /*
4+ * Copyright (c) 2015-present, Facebook, Inc.
5+ * All rights reserved.
6+ *
7+ * This source code is licensed under the MIT license found in the
8+ * LICENSE file in the root directory of this source tree.
9+ *
10+ */
11+
12+ namespace Facebook\HackRouter ;
13+
14+ type RouterOptions = shape(
15+ ' head_rewrite' => bool ,
16+ ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public function __construct(
2121 private dict <string , T > $routes ,
2222 private ?IResolver <T > $resolver = null ,
2323 ) {
24+ parent :: __construct();
2425 }
2526
2627 <<__Override >>
You can’t perform that action at this time.
0 commit comments