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

Bug: FeatureResponse::isOk and redirects #3072

Closed
MGatner opened this issue Jun 7, 2020 · 1 comment
Closed

Bug: FeatureResponse::isOk and redirects #3072

MGatner opened this issue Jun 7, 2020 · 1 comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@MGatner
Copy link
Member

MGatner commented Jun 7, 2020

Describe the bug
Am I missing something obvious? FeatureResponse::isOk looks like this:

		// Only 200 and 300 range status codes
		// are considered valid.
		if ($this->response->getStatusCode() >= 400 || $this->response->getStatusCode() < 200)
		{
			return false;
		}

		// Empty bodies are not considered valid.
		if (empty($this->response->getBody()))
		{
			return false;
		}

... but won't redirects (300 statuses) always have an empty body? Regardless of the always, if you use the standard return redirect()->to(... in a controller and then test it with FeatureTestCase then the resulting assertOk() will fail, which seems like a mistake to me.

CodeIgniter 4 version
develop

Affected module(s)
FeatureResponse

Expected behavior, and steps to reproduce if appropriate
See above

Context

  • OS: Linux
  • Web server: Apache
  • PHP version: 7.3
@MGatner MGatner added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 7, 2020
@lonnieezell
Copy link
Member

I believe you are correct. That should be accounted for.

MGatner added a commit that referenced this issue Jun 13, 2020
Fixed FeatureTest isOK to return true for redirects. Fixes #3072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants