Skip to content

[HttpClient] TransportException on multiple requests #32529

Closed
@Nyholm

Description

@Nyholm

Symfony version(s) affected: branch 4.4

Description

I know this is usually a server issue, But Im confident it isn't. I make a request like:

$client = new CurlHttpClient();
$response = $client->request(
    'GET',
    'https://foo.eu.auth0.com/api/v2/users?search_engine=v3&q=email%3A%22tobias%2Bmanager%40happyr.com%22',
    [
        'headers'=> ['Authorization' => 'Bearer eyJ0eXAiOiJ...'],
    ]
);

$x = $response->getStatusCode();
//$this->assertSame(200, $x);

$response = $client->request(
    'DELETE',
    'https://foo.eu.auth0.com/api/v2/users/auth0%7C5d2f790e26a0cf1347f7a/roles',
    [
        'headers'=> ['content-type' => 'application/json', 'Authorization' => 'Bearer eyJ0eXAiOiJ...'],
        'body' => '{"roles":["rol_ipXgFzjd2cH5"]}',
    ]
);

$y = $response->getStatusCode();
//$this->assertSame(204, $y);

Notes:

  • A) I tried doing the exact same request in Buzz and it works perfectly...
  • B) My Authorization header is 1034 characters long.
  • C) If I remove the content-type header from the second request then it works
  • D) If I only do the DELETE request, it also works.

The exception

Symfony\Component\HttpClient\Exception\TransportException: Failed sending data to the peer for "https://foo.eu.auth0.com/api/v2/users/auth0%7C5d2939f790e26a0cf1347f7a/roles".

src/Symfony/Component/HttpClient/Chunk/ErrorChunk.php:105
src/Symfony/Component/HttpClient/Response/CurlResponse.php:124
src/Symfony/Component/HttpClient/Response/ResponseTrait.php:67
src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php:95

Caused by
Symfony\Component\HttpClient\Exception\TransportException: Failed sending data to the peer for "https://foo.eu.auth0.com/api/v2/users/auth0%7C5d2939f790e26a0cf1347f7a/roles".

src/Symfony/Component/HttpClient/Response/CurlResponse.php:262
src/Symfony/Component/HttpClient/Response/ResponseTrait.php:289
src/Symfony/Component/HttpClient/Response/CurlResponse.php:124
src/Symfony/Component/HttpClient/Response/ResponseTrait.php:67
src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php:95

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions