Closed
Description
We should be able to format Requests/Responses to string.
Basic interface
<?php
namespace Http\Message;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* Formats a request or a response into string.
*
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
*/
interface Formatter
{
/**
* Formats a request.
*
* @param RequestInterface $request
*
* @return string
*/
public function formatRequest(RequestInterface $request);
/**
* Formats a response.
*
* @param ResponseInterface $response
*
* @return string
*/
public function formatResponse(ResponseInterface $response);
}
Some questions
- Should we separate Request/Response format method into separate interfaces? (Like in case of message factories)
Default implementations
- Simple text formatter: https://github.com/php-http/plugins/blob/master/src/Normalizer/Normalizer.php
- Curl command formatter: https://github.com/namshi/cuzzle
Metadata
Metadata
Assignees
Labels
No labels