Esempio n. 1
0
 public static function createRequest(RequestInterface $request)
 {
     $psrRequest = ServerRequestFactory::fromGlobals()->withUri($request->getUri())->withMethod($request->getMethod())->withBody($request->getBody());
     foreach ($request->getHeaders() as $name => $values) {
         $psrRequest = $psrRequest->withHeader($name, $values);
     }
     return $psrRequest;
 }
Esempio n. 2
0
 protected function getHeadersAsString(RequestInterface $request)
 {
     $headers = $request->getHeaders();
     $result = '';
     foreach ($headers as $name => $value) {
         $name = strtr($name, '-', ' ');
         $name = strtr(ucwords(strtolower($name)), ' ', '-');
         $result .= $name . ': ' . implode(', ', $value) . "\n";
     }
     return rtrim($result);
 }