Skip to content

Request::getUri() issue #8

@8ctopus

Description

@8ctopus

Trailing forward slash gets lost in your implementation while it's preserved in other libraries (for example httpsoft/http-message)

$request = new Request('GET', 'https://example.com/test/');
echo (string) $request->getUri(); // "https://example.com/test"

expected result:

$request = new Request('GET', 'https://example.com/test/');
echo (string) $request->getUri(); // "https://example.com/test/"

UPDATE: Looks like the behavior is intentional:

Capsule/src/Uri.php

Lines 238 to 243 in 0aa1c83

if( empty($this->path) && $this->getAuthority() ){
$url .= "/";
}
elseif( $this->path ) {
$url .= ("/" . \trim($this->path, "/"));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions