From dfbde4422ec47bf70b598046f50ef65f19d69ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 23 Feb 2018 12:41:53 +0100 Subject: [PATCH] Document the most common usage of HTTPlug I've seen several people complaining on this section being empty, and had no idea how to fill it, until today, when I wanted to write a smoke test for my application and had to figure it out. Hopefully this will get more people into HTTPlug. --- httplug/tutorial.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/httplug/tutorial.rst b/httplug/tutorial.rst index 1b46ba6..835fd1f 100644 --- a/httplug/tutorial.rst +++ b/httplug/tutorial.rst @@ -40,8 +40,22 @@ Create a file ``demo.php`` in the root folder and write the following code:: sendRequest( + $messageFactory->createRequest('GET', 'http://httplug.io') + ); + + var_dump($homeResponse->getStatusCode()); // 200, hopefully + + $missingPageResponse = $client->sendRequest( + $messageFactory->createRequest('GET', 'http://httplug.io/missingPage') + ); + + var_dump($missingPageResponse->getStatusCode()); // 404 Using an Asynchronous Client ----------------------------