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

The method throwUnless() does not exists in Http response class #50345

Closed
akalongman opened this issue Mar 2, 2024 · 2 comments
Closed

The method throwUnless() does not exists in Http response class #50345

akalongman opened this issue Mar 2, 2024 · 2 comments

Comments

@akalongman
Copy link

Laravel Version

10.46.0

PHP Version

8.2.15

Database Driver & Version

No response

Description

The official documentation says we can use $response->throwUnless() method: https://laravel.com/docs/10.x/http-client#throwing-exceptions
But the method throwUnless() does not exist in the vendor/laravel/framework/src/Illuminate/Http/Client/Response.php file.

Steps To Reproduce

<?php
use Illuminate\Http\Client\Response;
 
$response = Http::get('https://google.com');

$response->throwUnless(fn(Response $response) => $response->status() === 200);
@crynobone
Copy link
Member

I cannot find any reference other than #45704 and #42556

It seems that the documentation was incorrect to refer throwUnless() to Response instead of the correct PendingRequest.

@driesvints
Copy link
Member

We'd appreciate a PR to the docs for this one 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants