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

[9.x] Add conflict method to http client response #45718

Closed

Conversation

lentex
Copy link

@lentex lentex commented Jan 19, 2023

This PR adds a convenient method to check if a HTTP request resulted in a conflict (HTTP Status 409).

So instead of checking the status code manually, you can use this new method:

// Before
$response = Http::post('https://www.laravel.com', []);

if ($response->status() === 409) {
    doStuff();
}

// After
$response = Http::post('https://www.laravel.com', []);

if ($response->conflict()) {
    doStuff();
}

@lentex lentex changed the title Add conflict method to http client response [9.x] Add conflict method to http client response Jan 19, 2023
@taylorotwell
Copy link
Member

It's really fine to just check the status.

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

Successfully merging this pull request may close these issues.

2 participants