Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sarmadindhar's avatar

Problem in api request headers

I have built api using laravel passport and it works fine. BUt the problem happens whenever I am not passing any header like Authorization or Accept headers it provides me this error

"Type error: Argument 1 passed to Illuminate\Routing\Middleware\ThrottleRequests::addHeaders() must be an instance of Symfony\Component\HttpFoundation\Response, null given, called in C:\xampp\htdocs\bcit\vendor\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php on line 61

Is there any way to show custom response if no any header is present with request

0 likes
3 replies
aurawindsurfing's avatar

I suppose the easiest way for you would be to provide your app what it asks you for instead of writing own exceptions then ;-) It is possible but you need to have good understanding of how things work.

Try to find the easiest solution ;-)

Hope it helps!

Please or to participate in this conversation.