Fix FLEXIAPI-254 Allow no data on POST requests to not trigger the ValidateJSON middleware

This commit is contained in:
Timothée Jaussoin 2024-12-30 17:22:03 +01:00
parent e761e03309
commit 0dcb74ef19
3 changed files with 3 additions and 1 deletions

View file

@ -10,6 +10,7 @@ v1.7
- Fix FLEXIAPI-244 Remove faulty middleware
- Fix FLEXIAPI-250 Allow Spaces to be declared without a subdomain
- 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.6
----

View file

@ -10,6 +10,7 @@ use App\Rules\PnProvider;
use App\Rules\CallId;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Log;
class PushNotificationController extends Controller
{

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());