Skip to content

Commit

Permalink
Merge pull request #19 from weierophinney/feature/request-line-refactor
Browse files Browse the repository at this point in the history
Only work with the request target, not the line
  • Loading branch information
Paul M. Jones committed Jan 28, 2015
2 parents 5d725e6 + 0498921 commit 3e35e0a
Showing 1 changed file with 17 additions and 32 deletions.
49 changes: 17 additions & 32 deletions src/RequestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,56 +21,41 @@
interface RequestInterface extends MessageInterface
{
/**
* Retrieves the message's request line.
* Retrieves the message's request target.
*
* Retrieves the message's request line either as it will appear (for
* Retrieves the message's request-target either as it will appear (for
* clients), as it appeared at request (for servers), or as it was
* specified for the instance (see withRequestLine()).
* specified for the instance (see withRequestTarget()).
*
* This method MUST return a string of the form:
* In most cases, this will be the origin-form of the composed URI,
* unless a value was provided to the concrete implementation (see
* withRequestTarget() below).
*
* <code>
* HTTP_METHOD REQUEST_TARGET HTTP/PROTOCOL_VERSION
* </code>
*
* If the request line is calculated at method execution (i.e., not from
* a value set on the instance), the request-target MUST be in origin-form.
*
* If any aspect of the request line is unknown, it MUST raise an
* exception.
* If no URI is available, and no request-target has been specifically
* provided, this method MUST return the string "/".
*
* @return string
* @throws \RuntimeException if unable to construct a valid request line.
*/
public function getRequestLine();
public function getRequestTarget();

/**
* Create a new instance with a specific request line.
*
* If the request needs a specific request line — for instance, to allow
* specifying an absolute-form, authority-form, or asterisk-form
* request-target — this method may be used to create an instance with
* the specified request line, verbatim.
*
* This method MUST validate that the line is in the form:
*
* <code>
* HTTP_METHOD REQUEST_TARGET HTTP/PROTOCOL_VERSION
* </code>
* Create a new instance with a specific request-target.
*
* and raise an exception if not.
* If the request needs a non-origin-form request-target — e.g., for
* specifying an absolute-form, authority-form, or asterisk-form —
* this method may be used to create an instance with the specified
* request-target, verbatim.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return a new instance that has the
* changed request line.
* changed request target.
*
* @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various
* request-target forms allowed in request messages)
* @param mixed $requestLine
* @param mixed $requestTarget
* @return self
* @throws \InvalidArgumentException for invalid request lines.
*/
public function withRequestLine($requestLine);
public function withRequestTarget($requestTarget);

/**
* Retrieves the HTTP method of the request.
Expand Down

0 comments on commit 3e35e0a

Please sign in to comment.