Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recall reject callback when request fails during batch #97

Open
ronan-gloo opened this issue Feb 1, 2021 · 0 comments
Open

Recall reject callback when request fails during batch #97

ronan-gloo opened this issue Feb 1, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@ronan-gloo
Copy link
Contributor

Problem

The batchSend implementation of the Guzzle6Adapter never invoke the callback defined in the rejected option key when the request fails.

As a callback is set instead by the adapter, it is impossible to process errors when a call fails.

How to reproduce

  • Given : 2 requests, 1 success & 1 error
  • Expected : Both messages are displayed, means both callbacks were invoked
  • Actual : Only the fulfilled callback ("success") is reached
<?php
$halClient = (new Client())->getHalClient()->withToken('<api_key>');

$requests['success'] = $halClient->createRequest('GET', '/v1/ping'); // 200 here
$requests['error']      = $halClient->createRequest('GET', '/v1/pong'); // 404 here

$halClient->batchSend($requests, [
    'fulfilled' => function($response, $id) {
        echo "$id : OK\n";
    },
    'rejected' => function($exception, $id) {
        echo "$id : NOT OK\n";
    }
]);
@ronan-gloo ronan-gloo added the bug Something isn't working label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants