Drupal::request()->request->all() returns an empty array I have a custom controller that expects POST data. I had it working fine in 8.1.0 retrieving the data using \Drupal::request()-&gt;request-&gt;all() and \Drupal::request()-&gt;request-&gt;get($myvar).

Now, without any changes in my custom module, \Drupal::request()-&gt;request-&gt;all() is returning an empty array, and \Drupal::request()-&gt;request-&gt;get($myvar) is returning NULL.

Between the time it was working and when the issue arose, my hosting service Pantheon updated their Drupal 8 version from 8.1.0 to 8.1.1 and then 8.1.2. I suspect something may have changed then that affected this.

How can I fix this?

EDIT: Thanks for the comments, still not quite working...

Route YAML:

mymodule.foobar:
  path: '/foobar'
  options:
    _auth: [ 'basic_auth' ]
  defaults:
    _controller: '\Drupal\mymodule\Controller\FooBarController::foobar'
    _title: 'foobar'
  requirements:
    _user_is_logged_in: 'TRUE'
    _permission: 'administer site configuration'


Controller:

&lt;?php
namespace Drupal\mymodule\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
/**
 * Class FooBarController.
 *
 * @package Drupal\mymodule\Controller
 */
class FooBarController extends ControllerBase {
  /**
   * Provides content for the /mymodule/foobar path.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The current request
   */
  public function foobar(Request $request) {
    $content = $request-&gt;getContent();
    $data = array();
    $data['a'] = $request-&gt;get('foo');
    $data['b'] = $request-&gt;request-&gt;get('foo');
    $data['c'] = \Drupal::requestStack()-&gt;getCurrentRequest()-&gt;request-&gt;get('foo');
    $data['e'] = $request-&gt;request-&gt;all();
    $data['f'] = $content;

    $request = \Drupal::requestStack()-&gt;getCurrentRequest();
    $content = $request-&gt;getContent();
    $data['g'] = $request-&gt;get('foo');
    $data['h'] = $request-&gt;request-&gt;get('foo');
    $data['j'] = $request-&gt;request-&gt;all();
    $data['k'] = $content;

    return new JsonResponse((object) $data);
  }
}


Postman Request:


Note: This was working before with this exact code, correctly using basic HTTP authentication. There have been no changes other than these variations to my controller, and core updates.

Any more ideas?
Try this: 

$request = \Drupal::requestStack()-&gt;getCurrentRequest()-&gt;query-&gt;all();


Sidenote: Using a Controller you shouldn't use "\Drupal::..." static request call. Instead, you always have in your controller's enter point function a "Request $request" object as a last argument.