Skip to content

Allow supplying path along with parameters - #17

Open
thekid wants to merge 1 commit into
masterfrom
feature/accept-paths
Open

Allow supplying path along with parameters#17
thekid wants to merge 1 commit into
masterfrom
feature/accept-paths

Conversation

@thekid

@thekidthekid commented Jun 17, 2016

Copy link
Copy Markdown
Member

Example:

$conn= newHttpConnection('http://example.com');
// Previously both of the following worked$conn->get(['name' => 'Test', 'mail' => 'test@example.com']);
$conn->get('name=Test&mail=test@example.com');
// New functionality$conn->get('/index.php');
$conn->get('/index.php?name=Test&mail=test@example.com');

@thekid

thekid commented Jun 17, 2016

Copy link
Copy Markdown
MemberAuthor

We could go a bit further and support relative URLs, too, so that get() and friends' first arguments would accept most of the things you'd put into a <a href="...">...</a>. To reduce suprises, we should really deprecate pasing a string with paramters only (like 'name=Test&mail=test@example.com'), and require prefixing that with ? (as you'd have to in your link):

// Deprecated, raises warning$conn->get('name=Test&mail=test@example.com');
// Works, appends to base URL passed to constructor, just as would happen if in <a href="...">$conn->get('?name=Test&mail=test@example.com');

@mikey179@kiesel what do you think?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@thekid