> > When retrieving the request-target with getRequestTarget(), by default > this method will use the URI object and extract all the necessary > components to construct the *origin-form*. >
Please don't copy-paste PSR-7 - it's not answer. In given situation we sent wrong request because absolute-form in $requst->getRequestTarget() != (string) $requst->getUri(). RequestInterface::getUri() return UriInterface instance or you talk about strval(new Uri('')) MUST return '/'? воскресенье, 19 января 2020 г., 0:51:54 UTC+3 пользователь Matthew Weier O'Phinney написал: > > I think you're not understanding the purpose of the request-target within > a request. > > Section 1.4 of the PSR-7 spec details the purpose, and how different > values are interpreted. The point to understand, however, is that these > serve a different purpose than the composed UriInterface. The UriInterface > is used by a client in order to determine the protocol, port, and hostname > so that the client can connect to the server in question. The > request-target is the value used as the second segment of the request line > when transmitting the request. > > In PSR-7, if no request-target is provided, then the string form of the > URI fills in as an absolute-form request-target. > > Because the request-target can take a variety of forms that are not > compliant with a UriInterface implementation (e.g., asterix-form, for > OPTIONS requests; authority-form, for CONNECT requests; origin-form, which > is typically only the pat; etc.), we allow setting it _separately_ from the > URI. This means that setting it MUST NOT change the URI, as the point is > that this is to customize the request line, and otherwise not affect how a > client connects to the server. > > You ask "how URI can be not available?" When using PSR-17, it MUST be > present. However, if you are using a specific implementation, it's entirely > possible to construct a fully empty request. This is why we indicate the > default behavior when that happens. > > -- > Matthew Weier O'Phinney > mweiero...@gmail.com <javascript:> > https://mwop.net/ > he/him > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/1e548e05-1232-45d2-b17c-9db03e6fa5a5%40googlegroups.com.