Skip to content

Commit 3e35e0a

Browse files
author
Paul M. Jones
committed
Merge pull request #19 from weierophinney/feature/request-line-refactor
Only work with the request target, not the line
2 parents 5d725e6 + 0498921 commit 3e35e0a

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

src/RequestInterface.php

+17-32
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,41 @@
2121
interface RequestInterface extends MessageInterface
2222
{
2323
/**
24-
* Retrieves the message's request line.
24+
* Retrieves the message's request target.
2525
*
26-
* Retrieves the message's request line either as it will appear (for
26+
* Retrieves the message's request-target either as it will appear (for
2727
* clients), as it appeared at request (for servers), or as it was
28-
* specified for the instance (see withRequestLine()).
28+
* specified for the instance (see withRequestTarget()).
2929
*
30-
* This method MUST return a string of the form:
30+
* In most cases, this will be the origin-form of the composed URI,
31+
* unless a value was provided to the concrete implementation (see
32+
* withRequestTarget() below).
3133
*
32-
* <code>
33-
* HTTP_METHOD REQUEST_TARGET HTTP/PROTOCOL_VERSION
34-
* </code>
35-
*
36-
* If the request line is calculated at method execution (i.e., not from
37-
* a value set on the instance), the request-target MUST be in origin-form.
38-
*
39-
* If any aspect of the request line is unknown, it MUST raise an
40-
* exception.
34+
* If no URI is available, and no request-target has been specifically
35+
* provided, this method MUST return the string "/".
4136
*
4237
* @return string
43-
* @throws \RuntimeException if unable to construct a valid request line.
4438
*/
45-
public function getRequestLine();
39+
public function getRequestTarget();
4640

4741
/**
48-
* Create a new instance with a specific request line.
49-
*
50-
* If the request needs a specific request line — for instance, to allow
51-
* specifying an absolute-form, authority-form, or asterisk-form
52-
* request-target — this method may be used to create an instance with
53-
* the specified request line, verbatim.
54-
*
55-
* This method MUST validate that the line is in the form:
56-
*
57-
* <code>
58-
* HTTP_METHOD REQUEST_TARGET HTTP/PROTOCOL_VERSION
59-
* </code>
42+
* Create a new instance with a specific request-target.
6043
*
61-
* and raise an exception if not.
44+
* If the request needs a non-origin-form request-target — e.g., for
45+
* specifying an absolute-form, authority-form, or asterisk-form —
46+
* this method may be used to create an instance with the specified
47+
* request-target, verbatim.
6248
*
6349
* This method MUST be implemented in such a way as to retain the
6450
* immutability of the message, and MUST return a new instance that has the
65-
* changed request line.
51+
* changed request target.
6652
*
6753
* @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various
6854
* request-target forms allowed in request messages)
69-
* @param mixed $requestLine
55+
* @param mixed $requestTarget
7056
* @return self
71-
* @throws \InvalidArgumentException for invalid request lines.
7257
*/
73-
public function withRequestLine($requestLine);
58+
public function withRequestTarget($requestTarget);
7459

7560
/**
7661
* Retrieves the HTTP method of the request.

0 commit comments

Comments
 (0)