Skip to content

Commit 2122fbd

Browse files
committed
configurable JSON response
1 parent f6e9bb4 commit 2122fbd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Middleware/BlockBots.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function handle($request, Closure $next, $dailyLimit)
4646

4747
if ($blocked) {
4848
if ($request->expectsJson()) {
49-
return response()->json(['message' => 'You are over the specified limit.'], 429);
49+
return response()->json($this->config['json_response'], 429);
5050
}
5151
return response(view('block-bots::error'), 429);
5252
}

src/config/block-bots.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,12 @@
6969
'yahoo' => 'yahoo',
7070
'yandex' => 'yandex',
7171
],
72+
73+
/*
74+
* Default json response when blocked
75+
*/
76+
'json_response' => [
77+
'message' => 'Você está acima do limite.'
78+
],
7279
];
7380

0 commit comments

Comments
 (0)