Skip to content

Commit 4bec7e2

Browse files
Merge pull request #11556 from Ashim-Stha/createFolderWithHeader
[tests-only][full-ci] Add test for creating folder with `Transfer-Encoding: chunked` header
2 parents fefcdaa + c88e134 commit 4bec7e2

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

tests/acceptance/bootstrap/WebDav.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ public function makeDavRequest(
339339
* @param bool|null $isGivenStep
340340
* @param string|null $password
341341
* @param string|null $spaceId
342+
* @param array|null $headers
342343
*
343344
* @return ResponseInterface
344345
* @throws JsonException | GuzzleException
@@ -350,12 +351,13 @@ public function createFolder(
350351
?bool $isGivenStep = false,
351352
?string $password = null,
352353
?string $spaceId = null,
354+
?array $headers = [],
353355
): ResponseInterface {
354356
return $this->makeDavRequest(
355357
$user,
356358
"MKCOL",
357359
$folder,
358-
[],
360+
$headers,
359361
null,
360362
$spaceId,
361363
"files",
@@ -2729,6 +2731,32 @@ public function userCreatesFolder(string $user, string $destination): void {
27292731
$this->setResponse($response);
27302732
}
27312733

2734+
/**
2735+
* @When user :user creates folder :destination with the following headers using the WebDAV API
2736+
*
2737+
* @param string $user
2738+
* @param string $destination
2739+
* @param TableNode $table
2740+
*
2741+
* @return void
2742+
* @throws JsonException
2743+
* @throws GuzzleException
2744+
*/
2745+
public function userCreatesFolderWithTheFollowingHeadersUsingTheWebDavApi(
2746+
string $user,
2747+
string $destination,
2748+
TableNode $table,
2749+
): void {
2750+
$headers = [];
2751+
foreach ($table->getColumnsHash() as $header) {
2752+
$headerName = $header['header'];
2753+
$headerValue = $header['value'];
2754+
$headers[$headerName] = $headerValue;
2755+
}
2756+
$response = $this->createFolder(user: $user, folder: $destination, headers: $headers);
2757+
$this->setResponse($response);
2758+
}
2759+
27322760
/**
27332761
* @Given user :user has created folder :destination
27342762
*

tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,13 @@ Feature: create files and folder
264264
| spaces | /..fo |
265265
| spaces | /fo.xyz |
266266
| spaces | /fo.exe |
267+
268+
@issue-10809
269+
Scenario: create a folder with Transfer-Encoding: chunked header
270+
Given using spaces DAV path
271+
When user "Alice" creates folder "myFolder" with the following headers using the WebDAV API
272+
| header | value |
273+
# NOTE: requires system curl version >= 8.12.0
274+
| Transfer-Encoding | chunked |
275+
Then the HTTP status code should be "201"
276+
And as "Alice" folder "myFolder" should exist

0 commit comments

Comments
 (0)