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.';
}
2
  • Have you tried $request->all()?
    – Joe
    Mar 13, 2018 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, 2018 at 13:45

1 Answer 1

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

1
  • 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, 2018 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.