File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export abstract class EndpointRoute implements Route {
1010 private readonly path : string ;
1111
1212 /**
13- * @param method The required HTTP method to match.
13+ * @param method The required HTTP method to match. If GET, will also match HEAD.
1414 * @param path The request URL path to match.
1515 */
1616 protected constructor ( method : Request . Method , path : string ) {
@@ -19,7 +19,11 @@ export abstract class EndpointRoute implements Route {
1919 }
2020
2121 public match ( req : Request ) : boolean {
22- return req . method === this . method && req . url . pathname === this . path ;
22+ return this . path === req . url . pathname
23+ && (
24+ this . method === req . method
25+ || ( this . method === Request . Method . GET && req . method === Request . Method . HEAD )
26+ ) ;
2327 }
2428
2529 public abstract handle ( req : Request ) : Response | Promise < Response > ;
You can’t perform that action at this time.
0 commit comments