From f8807c4efbbddd02c69d0af63a1bf348b051d078 Mon Sep 17 00:00:00 2001 From: msquare Date: Sun, 19 Nov 2017 14:47:32 +0100 Subject: [PATCH] fix behaviour of HTTP/Request get --- src/Http/Request.php | 4 ++-- tests/Unit/Http/RequestTest.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Http/Request.php b/src/Http/Request.php index e7850c8b..585fb5e9 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -38,9 +38,9 @@ class Request extends SymfonyRequest */ public function has($key) { - $value = $this->input($key); + $value = $this->input($key, null); - return !empty($value); + return !($value === null); } /** diff --git a/tests/Unit/Http/RequestTest.php b/tests/Unit/Http/RequestTest.php index 3f317367..a68f8b8f 100644 --- a/tests/Unit/Http/RequestTest.php +++ b/tests/Unit/Http/RequestTest.php @@ -47,7 +47,8 @@ class RequestTest extends TestCase ]); $this->assertTrue($request->has('foo')); - $this->assertFalse($request->has('bar')); + $this->assertTrue($request->has('bar')); + $this->assertFalse($request->has('baz')); } /**