src/Signature/SignatureV4.php
public static function convertPostToGet(RequestInterface $request)
    {
        if ($request->getMethod() !== 'POST') {
            throw new \InvalidArgumentException('Expected a POST request but '
                . 'received a ' . $request->getMethod() . ' request.');
        }

        $sr = $request->withMethod('GET')
            ->withBody(Psr7\stream_for(''))
            ->withoutHeader('Content-Type')
            ->withoutHeader('Content-Length');

        // Move POST fields to the query if they are present
        if ($request->getHeaderLine('Content-Type') === 'application/x-www-form-urlencoded') {
            $body = (string) $request->getBody();
            $sr = $sr->withUri($sr->getUri()->withQuery($body));
        }

        return $sr;
    }
public static function convertPostToGet(RequestInterface $request)
    {
        if ($request->getMethod() !== 'POST') {
            throw new \InvalidArgumentException('Expected a POST request but '
                . 'received a ' . $request->getMethod() . ' request.');
        }

        $sr = $request->withMethod('GET')
            ->withBody(Psr7\stream_for(''))
            ->withoutHeader('Content-Type')
            ->withoutHeader('Content-Length');

        // Move POST fields to the query if they are present
        if ($request->getHeaderLine('Content-Type') === 'application/x-www-form-urlencoded') {
            $body = (string) $request->getBody();
            $sr = $sr->withUri($sr->getUri()->withQuery($body));
        }

        return $sr;
    }
public static function convertPostToGet ( RequestInterface $ request ) { if ( $ request -> getMethod ( ) !== 'POST' ) { throw new \ InvalidArgumentException ( 'Expected a POST request but ' . 'received a ' . $ request -> getMethod ( ) . ' request.' ) ; } $ sr = $ request -> withMethod ( 'GET' ) -> withBody ( Psr7 \ stream_for ( '' ) ) -> withoutHeader ( 'Content-Type' ) -> withoutHeader ( 'Content-Length' ) ; // Move POST fields to the query if they are present if ( $ request -> getHeaderLine ( 'Content-Type' ) === 'application/x-www-form-urlencoded' ) { $ body = ( string ) $ request -> getBody ( ) ; $ sr = $ sr -> withUri ( $ sr -> getUri ( ) -> withQuery ( $ body ) ) ; } return $ sr ; }
Converts a POST request to a GET request by moving POST fields into the
query string.

Useful for pre-signing query protocol requests.

@param RequestInterface $request Request to clone

@return RequestInterface
@throws \InvalidArgumentException if the method is not POST
Converts a POST request to a GET request by moving POST fields into the query string .