Answer the question
In order to leave comments, you need to log in
How to get custom headers from a request in Laravel 5?
Testing API for mobile applications using Postman. I'm trying to send tokens in headers, but there are no headers in the request object. If I send any standard content-type or accept headers, then I can get their values, but custom headers are not visible at all: neither their keys nor values.
For example, I send headers like this:
Then, I output them:
<?php
namespace App\Http\Controllers\API\MobileApp;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class OrdersController extends Controller
{
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
dd( $request->headers);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question