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

response data not set #2124

Closed
psuplat opened this issue Aug 10, 2019 · 2 comments
Closed

response data not set #2124

psuplat opened this issue Aug 10, 2019 · 2 comments

Comments

@psuplat
Copy link

psuplat commented Aug 10, 2019

Unless I am using it wrong it looks like the response->setJSON method is not working

I setup a very basic test controller as shown below:

class Foo extends BaseController
{

    public function bar()
    {
        $testData = [
            'success' => true,
            'id' => 123,
        ];
        $this->response->setStatusCode(401)->setJSON($testData);
    }
}

image

When I run the url in Postman I get the response code I set but body is empty. Am I missing something?

@MGatner
Copy link
Member

MGatner commented Aug 10, 2019

Can you try returning the response object?

@psuplat
Copy link
Author

psuplat commented Aug 11, 2019

Crap, need new glasses. It works like a charm - developer issue, not framework ;)

@psuplat psuplat closed this as completed Aug 11, 2019
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

2 participants