/** * Creates a new request object * * @param string method * @param peer.URL url * @return scriptlet.HttpScriptletRequest */ protected function newRequest($method, URL $url) { $q = $url->getQuery(''); $req = new \scriptlet\HttpScriptletRequest(); $req->method = $method; $req->env['SERVER_PROTOCOL'] = 'HTTP/1.1'; $req->env['REQUEST_URI'] = $url->getPath('/') . ($q ? '?' . $q : ''); $req->env['QUERY_STRING'] = $q; $req->env['HTTP_HOST'] = $url->getHost(); if ('https' === $url->getScheme()) { $req->env['HTTPS'] = 'on'; } $req->setHeaders(array()); $req->setParams($url->getParams()); return $req; }
public function default_contentTypeOf_request_with_body() { $req = new \scriptlet\HttpScriptletRequest(); $req->setHeaders(array('Transfer-Encoding' => 'chunked')); $this->assertEquals('application/octet-stream', $this->newFixture()->contentTypeOf($req)); }