Last active
April 10, 2019 08:34
-
-
Save Taluu/50aa950b4fcfd5997f69e1d11ead6cdf to your computer and use it in GitHub Desktop.
reproducer for symfony/symfony#30753
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"symfony/http-client": "^4.3@dev" | |
}, | |
"require-dev": { | |
"symfony/var-dumper": "^4.3@dev" | |
}, | |
"minimum-stability": "dev" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types=1); | |
use Symfony\Component\HttpClient\HttpClient; | |
require __DIR__ . '/vendor/autoload.php'; | |
$client = HttpClient::create(); | |
$r = $client->request( | |
'POST', | |
'http://localhost:8081', | |
[ | |
'auth_bearer' => 'foobaba', | |
'headers' => [ | |
'Content-Type' => 'application/json', | |
], | |
'body' => json_encode(['foo' => 'bar']), | |
] | |
); | |
if ($argv[1] ?? false) { | |
dump($r->getStatusCode()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: application/json+ld'); | |
header("HTTP/1.1 500 Internal Server Error"); | |
echo <<<JSON | |
[ | |
{ | |
"foo": "bar" | |
}, | |
{ | |
"foo": {"baz": "baz"} | |
}, | |
{ | |
"foo": [1, 2, 3] | |
} | |
] | |
JSON; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use ;
composer install
php -S localhost:8081 server.php
php reproducer.php
, it should throw thefailed writing headers
from theTransportException
php reproducer.php foo
, it should dump 500.