Fix/254 empty post validate json 16

This commit is contained in:
Timothée Jaussoin 2025-01-06 08:53:59 +00:00
parent 21bced8764
commit 14a1df8bcd
2 changed files with 2 additions and 1 deletions

View file

@ -16,6 +16,7 @@ v1.6
- Fix GH-15 Add password import from CSV
- Fix FLEXIAPI-242 Add stricter validation for the AccountCreationToken Push Notification endpoint
- Fix FLEXIAPI-252 Update the hCaptcha Laravel library, use file instead of cookies to store the session to prevent empty errors bags
- Fix FLEXIAPI-254 Allow no data on POST requests to not trigger the ValidateJSON middleware
v1.5
---

View file

@ -11,7 +11,7 @@ class ValidateJSON
public function handle(Request $request, Closure $next)
{
if ($request->expectsJson()) {
if ($request->expectsJson() && !empty($request->getContent())) {
json_decode($request->getContent());
if (json_last_error() !== JSON_ERROR_NONE) {
abort(400, self::$message . ': ' . json_last_error_msg());