I have a Laravel app that makes a request to my Lumen API and passes a parameter to the HTTP header using GuzzleHttp\Client.
Below is the relevant code for the request made by Laravel app:
public function getJson($url) {
$client = new Client;
$header = [
'admin_user_id' => 2,
];
$response = $client->request('GET', $url , [
'headers' => $header
]);
return $response->getBody();
}
Then in my Lumen API, I try to access parameter value from http header as below:
use Illuminate\Http\Request;
class ProductController extends Controller {
public function fetch_all(Request $request) {
return $user_id = $request->header('admin_user_id');
}
}
However, $request->header('admin_user_id');
doesn't seem to be returning any value.