<?php require __DIR__ . '/../vendor/autoload.php'; $request = new Amp\Artax\Request(); /** * **IMPORTANT:** All of the following examples apply to Amp\Artax\Request *and* Amp\Artax\Response. * * Headers are stored with case-insensitive keys (as per RFC 2616 Sec4.2). You can access and * assign message headers in requests/responses without worrying about case. Assigning headers is * accomplished using Message::setHeader() which will clear any previously assigned values for the * same header (regardless of field case): */ $request->setHeader('Content-Type', 'application/octet-stream'); assert($request->hasHeader('CONTENT-TYPE')); // true assert($request->hasHeader('CoNtEnT-tYpE')); // true assert($request->hasHeader('content-type')); // true assert($request->getHeader('conTENT-tyPE')[0] === 'application/octet-stream'); // true $request->setHeader('CONTENT-TYPE', 'text/plain'); assert($request->getHeader('Content-Type')[0] === 'text/plain'); // true /** * 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