Skip to content

Commit 35d97ea

Browse files
authored
Replace 418 response method with raw denial
Simplify code
1 parent 3113112 commit 35d97ea

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

includes/ResponseFactory.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ public function __construct( ServiceOptions $options ) {
7777
public function denyAccess( $output ): void {
7878
if ( $this->options->get( 'CrawlerProtectionRawDenial' ) ) {
7979
if ( $this->options->get( 'CrawlerProtectionUse418' ) ) {
80-
$this->denyAccessWith418();
80+
$this->denyAccessRaw(
81+
self::TEAPOT_HEADER,
82+
self::TEAPOT_BODY
83+
);
8184
} else {
8285
$this->denyAccessRaw(
8386
$this->options->get( 'CrawlerProtectionRawDenialHeader' ),
@@ -91,16 +94,6 @@ public function denyAccess( $output ): void {
9194
}
9295
}
9396

94-
/**
95-
* Output a 418 "I'm a teapot" response and halt.
96-
*
97-
* @return void
98-
* @suppress PhanPluginNeverReturnMethod
99-
*/
100-
protected function denyAccessWith418(): void {
101-
$this->denyAccessRaw( self::TEAPOT_HEADER, self::TEAPOT_BODY );
102-
}
103-
10497
/**
10598
* Output a raw HTTP response and halt.
10699
*

0 commit comments

Comments
 (0)