Skip to content

Conversation

@thekid
Copy link
Member

@thekid thekid commented Jun 17, 2016

Example:

$conn= new HttpConnection('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
Copy link
Member Author

thekid commented Jun 17, 2016

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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants