From 3dd35ef6ecd090253dc05a9a60d0d19692db21d8 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Thu, 18 Nov 2021 08:03:50 +0000
Subject: [PATCH] Possibly fixing the test

---
 src/Security/BasicAuth.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Security/BasicAuth.php b/src/Security/BasicAuth.php
index 52657057e..eaed9d22e 100644
--- a/src/Security/BasicAuth.php
+++ b/src/Security/BasicAuth.php
@@ -177,7 +177,10 @@ class BasicAuth
 				return 0;
 			}
 			Logger::debug('Access denied', ['parameters' => $_SERVER]);
-			header('WWW-Authenticate: Basic realm="Friendica"');
+			// Checking for commandline for the tests, we have to avoid to send a header
+			if (php_sapi_name() !== 'cli') {
+				header('WWW-Authenticate: Basic realm="Friendica"');
+			}
 			throw new UnauthorizedException("This API requires login");
 		}