1

I have a route that is set up to receive POST requests. This route is used to handle AWS SNS notifications.

The controller isn't receiving any data when hit. SNS sends JSON in the request body, but I can't get that with $request->getContent();.

To debug, I would like to see the full original request, including all headers and the body.

Request $request seems to strip out some stuff. Is there a method to get the full and complete original request with all headers as it was sent/received?

My code:

public function sns(Request $request)
{
    $payload = json_decode($request->getContent(), true);
    mail('m***@***.com', 'SNS '.time(), print_r($payload, true));
    echo 'Sent.';
}
Mike
  • 8,767
  • 8
  • 49
  • 103
  • Have you tried `$request->all()`? – Joe Mar 13 '18 at 12:12
  • `$request->all()` gives an array of values in the key-value space. It does not include any headers or anything in the body of the request. I want the full, unedited, unsanitized, untouched request. – Mike Mar 13 '18 at 13:45

1 Answers1

0

$request->all() will get you an array of all "input" data on the request.

You can see all available methods and properties on the Illuminate\Http\Request class here: https://laravel.com/api/5.6/Illuminate/Http/Request.html

Joe
  • 4,618
  • 3
  • 28
  • 35
  • 1
    `$request->all()` gives an array of values in the key-value space. It does not include any headers or anything in the body of the request. I want the full, unedited, unsanitized, untouched request. – Mike Mar 13 '18 at 13:45