send X-Request-Id in header of every request (#7238)

This commit is contained in:
Prajwol Amatya
2023-09-07 10:33:44 +05:45
committed by GitHub
parent ac5270b3c6
commit 620b44c90a
15 changed files with 86 additions and 65 deletions
@@ -166,7 +166,7 @@ class ArchiverContext implements Context {
$queryString = $this->getArchiverQueryString($owner, $resource, $addressType);
return HttpRequestHelper::get(
$this->featureContext->getBaseUrl() . '/archiver?' . $queryString,
'',
$this->featureContext->getStepLineRef(),
$downloader,
$this->featureContext->getPasswordForUser($downloader),
$headers
@@ -199,7 +199,7 @@ class ArchiverContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::get(
$this->featureContext->getBaseUrl() . '/archiver?' . $queryString,
'',
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
)
@@ -432,7 +432,9 @@ class NotificationContext implements Context {
GraphHelper::getMySpaces(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user)
$this->featureContext->getPasswordForUser($user),
'',
$this->featureContext->getStepLineRef()
)
);
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
@@ -541,7 +543,7 @@ class NotificationContext implements Context {
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
'POST',
$this->globalNotificationEndpointPath,
'',
$this->featureContext->getStepLineRef(),
json_encode($payload),
2
);
@@ -608,7 +610,7 @@ class NotificationContext implements Context {
$user ? $this->featureContext->getPasswordForUser($user) : $this->featureContext->getAdminPassword(),
'DELETE',
$this->globalNotificationEndpointPath,
'',
$this->featureContext->getStepLineRef(),
json_encode($payload),
2
);
@@ -64,7 +64,6 @@ class SearchContext implements Context {
$user = $this->featureContext->getActualUsername($user);
$baseUrl = $this->featureContext->getBaseUrl();
$password = $this->featureContext->getPasswordForUser($user);
$headers['X-Request-Id'] = WebDavHelper::generateUUIDv4();
$body
= "<?xml version='1.0' encoding='utf-8' ?>\n" .
" <oc:search-files xmlns:a='DAV:' xmlns:oc='http://owncloud.org/ns' >\n" .
@@ -103,7 +102,7 @@ class SearchContext implements Context {
$password,
"REPORT",
"/",
$headers,
null,
$this->featureContext->getStepLineRef(),
$body,
$this->featureContext->getDavPathVersion()
@@ -58,7 +58,7 @@ class SettingsContext implements Context {
public function getAllExistingRoles(string $user): void {
$fullUrl = $this->baseUrl . $this->settingsUrl . "roles-list";
$this->featureContext->setResponse(
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), "{}")
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), "{}", $this->featureContext->getStepLineRef())
);
}
@@ -77,7 +77,7 @@ class SettingsContext implements Context {
$body = json_encode(["account_uuid" => $userId, "role_id" => $roleId], JSON_THROW_ON_ERROR);
$this->featureContext->setResponse(
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body)
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef())
);
}
@@ -93,7 +93,7 @@ class SettingsContext implements Context {
public function sendRequestAssignmentsList(string $user, string $userId): ResponseInterface {
$fullUrl = $this->baseUrl . $this->settingsUrl . "assignments-list";
$body = json_encode(["account_uuid" => $userId], JSON_THROW_ON_ERROR);
return $this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body);
return $this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef());
}
/**
@@ -271,7 +271,7 @@ class SettingsContext implements Context {
public function sendRequestGetBundlesList(string $user): void {
$fullUrl = $this->baseUrl . $this->settingsUrl . "bundles-list";
$this->featureContext->setResponse(
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), '{}')
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), '{}', $this->featureContext->getStepLineRef())
);
$this->featureContext->theHTTPStatusCodeShouldBe(
@@ -312,7 +312,7 @@ class SettingsContext implements Context {
$fullUrl = $this->baseUrl . $this->settingsUrl . "values-list";
$body = json_encode(["account_uuid" => "me"], JSON_THROW_ON_ERROR);
$this->featureContext->setResponse(
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body)
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef())
);
Assert::assertEquals(
@@ -392,7 +392,7 @@ class SettingsContext implements Context {
);
$this->featureContext->setResponse(
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body)
$this->spacesContext->sendPostRequestToUrl($fullUrl, $user, $this->featureContext->getPasswordForUser($user), $body, $this->featureContext->getStepLineRef())
);
}
@@ -272,7 +272,7 @@ class SpacesContext implements Context {
return HttpRequestHelper::get(
$fullUrl,
"",
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
[],
@@ -341,7 +341,7 @@ class SpacesContext implements Context {
$this->featureContext->getPasswordForUser($user),
"",
['oc:privatelink'],
"",
$this->featureContext->getStepLineRef(),
"0",
"files",
WebDavHelper::DAV_VERSION_SPACES
@@ -437,14 +437,16 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$userAdmin,
$this->featureContext->getPasswordForUser($userAdmin),
$value["id"]
$value["id"],
$this->featureContext->getStepLineRef()
);
}
GraphHelper::deleteSpace(
$this->featureContext->getBaseUrl(),
$userAdmin,
$this->featureContext->getPasswordForUser($userAdmin),
$value["id"]
$value["id"],
$this->featureContext->getStepLineRef()
);
}
}
@@ -517,7 +519,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
"?" . $query
"?" . $query,
$this->featureContext->getStepLineRef()
)
);
$this->rememberTheAvailableSpaces();
@@ -544,7 +547,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
"?" . $query
"?" . $query,
$this->featureContext->getStepLineRef()
)
);
$this->rememberTheAvailableSpaces();
@@ -571,7 +575,9 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"]
$space["id"],
'',
$this->featureContext->getStepLineRef()
)
);
}
@@ -603,7 +609,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$body
$body,
$this->featureContext->getStepLineRef()
)
);
$this->setSpaceCreator($spaceName, $user);
@@ -659,7 +666,7 @@ class SpacesContext implements Context {
$this->featureContext->getPasswordForUser($user),
$foldersPath,
[],
'',
$this->featureContext->getStepLineRef(),
'infinity',
'files',
WebDavHelper::DAV_VERSION_SPACES
@@ -686,7 +693,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
$url,
"",
$this->featureContext->getStepLineRef(),
"PATCH",
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
@@ -1251,7 +1258,8 @@ class SpacesContext implements Context {
$user,
$this->featureContext->getPasswordForUser($user),
$body,
$spaceId
$spaceId,
$this->featureContext->getStepLineRef()
);
}
@@ -1408,7 +1416,8 @@ class SpacesContext implements Context {
$user,
$this->featureContext->getPasswordForUser($user),
$body,
$spaceId
$spaceId,
$this->featureContext->getStepLineRef()
)
);
}
@@ -1505,7 +1514,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$body
$body,
$this->featureContext->getStepLineRef()
);
}
@@ -1641,7 +1651,6 @@ class SpacesContext implements Context {
):void {
$space = $this->getSpaceByName($user, $fromSpaceName);
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName);
$headers['X-Request-Id'] = WebDavHelper::generateUUIDv4();
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileSource, "/");
$this->featureContext->setResponse($this->copyFilesAndFoldersRequest($user, $fullUrl, $headers));
}
@@ -1853,7 +1862,8 @@ class SpacesContext implements Context {
$fullUrl,
$user,
$this->featureContext->getPasswordForUser($user),
$body
$body,
$this->featureContext->getStepLineRef()
);
}
@@ -1911,7 +1921,8 @@ class SpacesContext implements Context {
$fullUrl,
$user,
$this->featureContext->getPasswordForUser($user),
$body
$body,
$this->featureContext->getStepLineRef()
)
);
$response = $this->featureContext->getResponseXml(null, __METHOD__);
@@ -1972,7 +1983,7 @@ class SpacesContext implements Context {
$fullUrl = $this->baseUrl . $this->ocsApiUrl . '/' . $shareId;
return HttpRequestHelper::sendRequest(
$fullUrl,
"",
$this->featureContext->getStepLineRef(),
"PUT",
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
@@ -2034,7 +2045,8 @@ class SpacesContext implements Context {
$fullUrl,
$user,
$this->featureContext->getPasswordForUser($user),
$body
$body,
$this->featureContext->getStepLineRef()
)
);
@@ -2134,7 +2146,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::delete(
$fullUrl,
"",
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user)
)
@@ -2161,7 +2173,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::delete(
$spaceWebDavUrl,
"",
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user)
)
@@ -2210,7 +2222,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"]
$space["id"],
$this->featureContext->getStepLineRef()
)
);
}
@@ -2282,7 +2295,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"]
$space["id"],
$this->featureContext->getStepLineRef()
)
);
}
@@ -2309,7 +2323,8 @@ class SpacesContext implements Context {
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"]
$space["id"],
$this->featureContext->getStepLineRef()
)
);
}
@@ -2351,7 +2366,7 @@ class SpacesContext implements Context {
$space = $this->getSpaceByName($user, $spaceName);
$fullUrl = $this->baseUrl . $this->davSpacesUrl . "trash-bin/" . $space["id"];
$this->featureContext->setResponse(
HttpRequestHelper::sendRequest($fullUrl, '', 'PROPFIND', $user, $this->featureContext->getPasswordForUser($user))
HttpRequestHelper::sendRequest($fullUrl, $this->featureContext->getStepLineRef(), 'PROPFIND', $user, $this->featureContext->getPasswordForUser($user))
);
}
@@ -2371,7 +2386,7 @@ class SpacesContext implements Context {
$space = $this->getSpaceByNameManager($user, $spaceName);
$fullUrl = $this->baseUrl . $this->davSpacesUrl . "trash-bin/" . $space["id"];
$this->featureContext->setResponse(
HttpRequestHelper::sendRequest($fullUrl, '', 'PROPFIND', $user, $this->featureContext->getPasswordForUser($user))
HttpRequestHelper::sendRequest($fullUrl, $this->featureContext->getStepLineRef(), 'PROPFIND', $user, $this->featureContext->getPasswordForUser($user))
);
}
@@ -2480,7 +2495,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
$fullUrl,
"",
$this->featureContext->getStepLineRef(),
'MOVE',
$user,
$this->featureContext->getPasswordForUser($user),
@@ -2524,7 +2539,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
$fullUrl,
"",
$this->featureContext->getStepLineRef(),
'DELETE',
$user,
$this->featureContext->getPasswordForUser($user),
@@ -2572,7 +2587,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::get(
$fullUrl,
"",
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user)
)
@@ -2867,7 +2882,8 @@ class SpacesContext implements Context {
$fullUrl,
$user,
$this->featureContext->getPasswordForUser($user),
$body
$body,
$this->featureContext->getStepLineRef()
)
);
@@ -3115,7 +3131,7 @@ class SpacesContext implements Context {
$this->featureContext->getPasswordForUser($user),
$resource,
$properties,
"",
$this->featureContext->getStepLineRef(),
"0",
"files",
WebDavHelper::DAV_VERSION_SPACES
@@ -3237,7 +3253,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::get(
$this->featureContext->getBaseUrl() . '/archiver?' . $queryString,
'',
$this->featureContext->getStepLineRef(),
'',
'',
)
@@ -3328,7 +3344,7 @@ class SpacesContext implements Context {
$this->featureContext->setResponse(
HttpRequestHelper::get(
$url,
'',
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
)
@@ -139,7 +139,8 @@ class TagContext implements Context {
GraphHelper::getTags(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user)
$this->featureContext->getPasswordForUser($user),
$this->featureContext->getStepLineRef()
)
);
}
@@ -642,6 +642,7 @@ class WebDavLockingContext implements Context {
$password,
'GET',
"/apps/testing/api/v1/app/core/lock-breaker-groups",
$this->featureContext->getStepLineRef(),
(string) $ocsApiVersion
);