@@ -173,6 +173,18 @@ $message
173
173
->addCookie(new Cookie('PHPSESSID', '<MY_SESSION_ID>'))
174
174
->setBody($messageBody);
175
175
176
+ // Please note, that headers have some unusual behaviours.
177
+ // Header names have an uniform way of nomenclature so the three getter calls would have the same result.
178
+ $header1 = $message->getHeaderByName('Content-Type');
179
+ $header2 = $message->getHeaderByName('content-type');
180
+ $header3 = $message->getHeaderByName('CONTENT-Type');
181
+
182
+ // To allow multiple request headers using the same name, the method `addAdditionalHeader` provides such a logic.
183
+ // Add or replace a request header
184
+ $message->addHeader(new Header('Custom-Header', array('CustomHeaderValue')));
185
+ // Add a request header and keep the existing one untouched
186
+ $message->addAdditionalHeader(new Header('Custom-Header', array('AnotherCustomHeaderValue')));
187
+
176
188
// Configuring and performing a Request
177
189
$request = new Request();
178
190
$response = $request
@@ -203,6 +215,8 @@ Cookie: PHPSESSID=<MY_SESSION_ID>
203
215
Content-Type: application/json
204
216
Accept: application/json, text/*
205
217
Runscope-Bucket-Auth: 7a64dde7-74d5-4eed-b170-a2ab406eff08
218
+ Custom-Header: CustomHeaderValue
219
+ Custom-Header: AnotherCustomHeaderValue
206
220
Content-Length: 102
207
221
208
222
{"paramName1":"paramValue1","paramName2":"paramValue2","paramName3":{"key1":"value1","key2":"value2"}}
0 commit comments