* Cookie: cookie2=val2 * Cookie: cookie3=val3 */ $request->setHeader('Cookie', ['cookie1=val1', 'cookie2=val2', 'cookie3=val3']); /** * Append headers without overwriting using Message::appendHeader(): */ assert(count($request->getHeader('cookie')) === 3); // true $request->appendHeader('Cookie', 'cookie4=val4'); assert(count($request->getHeader('Cookie')) === 4); // true /** * You may set multiple headers at one time via $request->setAllHeaders(): */ $request->setAllHeaders(['X-My-Header' => 'some value', 'Accept' => '*/*', 'Cookie' => ['cookie1=val1', 'cookie1=val2']]); /** * You can remove a previously assigned header value using Message::removeHeader(). Once again, * the header field name is case-insensitive: */ $request->removeHeader('cookie'); assert(!$request->hasHeader('Cookie')); // true /** * If you attempt to retrieve a non-existent header Amp\Artax will throw a DomainException: */ try { $request->getHeader('Some-Header-That-Isnt-Assigned'); die('Expected exception not thrown'); } catch (DomainException $e) { // Yep, it worked correctly.