CustomHeaderTest: add extra test cases for `testAddAndGetCustomHeader()` method

This commit is contained in:
jrfnl 2021-07-04 06:14:05 +02:00
parent d2a1a20097
commit 07be3bc7ff
1 changed files with 42 additions and 0 deletions

View File

@ -84,6 +84,14 @@ final class CustomHeaderTest extends TestCase
['yux', ''],
],
],
'Custom header: whitespace around name and value' => [
'headers' => [
[' name ', ' value '],
],
'expected' => [
['name', 'value'],
],
],
'Custom headers: "name: value" sets' => [
'headers' => [
['Content-Type: application/json'],
@ -94,6 +102,40 @@ final class CustomHeaderTest extends TestCase
['SomeHeader', 'Some Value'],
],
],
'Custom headers: "name:value" sets, no space and lots of space' => [
'headers' => [
['Content-Type:application/json'],
['SomeHeader : Some Value'],
],
'expected' => [
['Content-Type', 'application/json'],
['SomeHeader', 'Some Value'],
],
],
'Custom headers: "name: value" set with a colon in the value' => [
'headers' => [
['name: value:value'],
],
'expected' => [
['name', 'value:value'],
],
],
'Custom headers: "name: value" set without a value' => [
'headers' => [
['name:'],
],
'expected' => [
['name', ''],
],
],
'Custom header: "name: value" set with whitespace around name and value' => [
'headers' => [
[' name : value '],
],
'expected' => [
['name', 'value'],
],
],
'Custom headers: duplicate headers' => [
'headers' => [
['SomeHeader: Some Value'],