Esempio n. 1
0
 private function getDefaultOptions(puzzle_message_RequestInterface $request)
 {
     $headers = puzzle_message_AbstractMessage::getHeadersAsString($request);
     $context = array('http' => array('method' => $request->getMethod(), 'header' => trim($headers), 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => true, 'follow_location' => 0));
     if ($body = $request->getBody()) {
         $context['http']['content'] = (string) $body;
         // Prevent the HTTP adapter from adding a Content-Type header.
         if (!$request->hasHeader('Content-Type')) {
             $context['http']['header'] .= "\r\nContent-Type:";
         }
     }
     return $context;
 }