Skip to content

Commit 6b89d3a

Browse files
committed
MQE-1354: bug fix in command.php
1 parent b754b18 commit 6b89d3a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

etc/config/command.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@
5454
*/
5555
function isAuthenticated($baseUrl, $username, $password)
5656
{
57-
$userData = [
58-
"username" => $username,
59-
"password" => $password
57+
$userData = ["username" => $username, "password" => $password];
58+
$headers = [
59+
"Content-Type: application/json",
60+
"Content-Lenght: " . strlen(json_encode($userData))
6061
];
6162
$ch = curl_init($baseUrl . "/index.php/rest/V1/integration/admin/token");
6263
curl_setopt($ch, CURLOPT_POST, true);
@@ -66,11 +67,7 @@ function isAuthenticated($baseUrl, $username, $password)
6667
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
6768
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
6869
curl_setopt($ch, CURLOPT_COOKIEFILE, '');
69-
curl_setopt(
70-
$ch,
71-
CURLOPT_HTTPHEADER,
72-
array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData)))
73-
);
70+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
7471

7572
$token = curl_exec($ch);
7673

0 commit comments

Comments
 (0)