title: Unable to pass post variables in http request from Electron to Yii API
body: <p>I want to make API (Get &amp; Post) requests to an API build with Yii2 using Electron.
  I have tried Axion, Fetch, HTTP, request modules and all of them gave me the same error:</p>
  <blockquote>
  <p>data: {
  name: 'PHP Notice',
  message: 'Undefined index: username',
  code: 8,
  type: 'yii\base\ErrorException',
  file: 'C:\xampp\htdocs\app\controllers\ApiController.php',
  line: 898,
  'stack-trace': [Array]
  }</p>
  </blockquote>
  <p>Here is the code for the action I want to call:</p>
  <pre><code>public function actionLogin(){
    if(Yii::$app-&gt;request-&gt;isPost){
      Yii::$app-&gt;response-&gt;format = Response::FORMAT_JSON;
      $data = Yii::$app-&gt;request-&gt;post();
      $username = $data['username'];
      $password = $data['password'];
      $device_token = $data['device_token'];
      $prefix = substr($username, 0, 3);
      $model = null;
      }
  }
  </code></pre>
  <p>And here is the code in Electron:</p>
  <pre><code>axios.post('http://localhost:8080/app/api/login', {
      username: 'Fred',
      psssword: 'Flintstone'
    })
    .then(function (response) {
      console.log(response);
    });
  </code></pre>
  <p>For some reason, the parameters are not passing to the action.
  I have tried a lot of ways and this one seems to be the simplest.
  P.S. all of the way I have tried gave the same error.</p>