0

How can I get value of two request header parameters with same name in laravel? in Postman I called a specific route of application and set header parameter named msg two times with two different values. but in laravel controller, when I use $request->header("msg") it gives me just first msg header! how is it possible two access to both headers named msg?

picture:

controller

response

  • I'm not sure if you can send the same header twice with different values. Maybe you have to do it this way: https://stackoverflow.com/questions/3096888/standard-for-adding-multiple-values-of-a-single-http-header-to-a-request-or-resp – shaedrich Jul 05 '21 at 14:05
  • I don’t know Laravel too well, but I do know that they use parts of Symfony, so maybe this is applicable. The [`getHeader`](https://github.com/symfony/symfony/blob/14c45f43b6a00e69efbe74df8dd1a02a970f7ada/src/Symfony/Component/BrowserKit/Response.php#L89) method returns an array if false is passed as the second argument. Maybe something similar is in Laravel? – Chris Haas Jul 05 '21 at 14:08
  • @shaedrich Thanks for your recommendation, but I need to define two different header param with same name. – info bevedel Jul 05 '21 at 15:13
  • @ChrisHaas, Thank you for your help, unfortunately there is not such a function in laravel as I know. – info bevedel Jul 05 '21 at 15:14

0 Answers0