Skip to content

Conversation

@thekid
Copy link
Member

@thekid thekid commented Aug 26, 2018

This adds a new API to stream requests:

use peer\http\HttpConnection;
use peer\http\HttpRequest;
use util\cmd\Console;

$data= 'var1=1&var2=2';

$conn= new HttpConnection('http://localhost:8080/target');

$req= $conn->create(new HttpRequest());
$req->setMethod('POST');
$req->setHeader('Content-Type', 'application/x-www-form-urlencoded');
$req->setHeader('Content-Length', strlen($data));
$req->setHeader('X-User-Id', 6100);

$transfer= $conn->open($req);
$transfer->write($data);
$res= $conn->finish($transfer);

Console::writeLine($res);

thekid added a commit to xp-forge/rest-client that referenced this pull request Aug 30, 2018
@thekid thekid merged commit 9247ed4 into master Aug 30, 2018
@thekid thekid deleted the feature/open-stream branch August 30, 2018 14:31
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