/** * You can assign multiple header lines by passing an array of scalar values as the header value. * When sent by Amp\Artax the relevant portion of the raw request message for the below set of headers * will look like this: * * Cookie: cookie1=val1 * 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: