Skip to content

Commit

Permalink
set resource location from response
Browse files Browse the repository at this point in the history
  • Loading branch information
KarunAtreya committed Sep 21, 2023
1 parent b17f049 commit 93a889b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tests/acceptance/features/bootstrap/TUSContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public function createNewTUSResourceWithHeaders(string $user, TableNode $headers
false,
$password
);
$locationHeader = $response->getHeader('Location');
if (\sizeof($locationHeader) > 0) {
$this->resourceLocation = $locationHeader[0];
}
return $response;
}

Expand All @@ -87,10 +91,6 @@ public function createNewTUSResourceWithHeaders(string $user, TableNode $headers
public function userCreateNewTUSResourceWithHeaders(string $user, TableNode $headers, string $content = ''): void {
$response = $this->createNewTUSResourceWithHeaders($user, $headers, $content);
$this->featureContext->setResponse($response);
$locationHeader = $this->featureContext->getResponse()->getHeader('Location');
if (\sizeof($locationHeader) > 0) {
$this->resourceLocation = $locationHeader[0];
}
}

/**
Expand All @@ -109,10 +109,6 @@ public function createNewTUSResource(string $user, TableNode $headers): void {
$rows[] = ['Tus-Resumable', '1.0.0'];
$response = $this->createNewTUSResourceWithHeaders($user, new TableNode($rows));
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
$locationHeader = $response->getHeader('Location');
if (\sizeof($locationHeader) > 0) {
$this->resourceLocation = $locationHeader[0];
}
}

/**
Expand Down Expand Up @@ -395,10 +391,6 @@ public function userCreatesWithUpload(
): void {
$response = $this->createNewTUSResourceWithHeaders($user, $headers, $content);
$this->featureContext->setResponse($response);
$locationHeader = $this->featureContext->getResponse()->getHeader('Location');
if (\sizeof($locationHeader) > 0) {
$this->resourceLocation = $locationHeader[0];
}
}

/**
Expand Down

0 comments on commit 93a889b

Please sign in to comment.