-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Sails responses not working with --no-frontend flag #3557
Comments
Hi @revic1993. Sorry you're having a problem with your Sails app. We'll need a bit more information before looking into this (in the future, before posting an issue please take a look at our issue posting guidelines).
Also, can you set up a repo that reproduces this issue? For example:
|
@revic1993 hmm... this might have something to do with the environment configuration your tests are using. Best thing would be for us to take a look at a repo that reproduces this like @sgress454 mentioned. Thanks! |
On a side note, we experimented with this and I think it's time we revert it. res.badRequest(), res.forbidden(), and res.notFound() (everything except res.negotiate() and res.serverError() realistically) are designed to be used for intentional API responses with specific response data. So the response body should not be stripped in production by default (whether or not config is available). So @revic1993 if it turns out that's your issue, good news is it's really easy to resolve by changing the default files in |
@mikermcneil Not sure what reverting would do--the default was always to strip the errors in production. That config option was added to allow them to not be stripped. Unless you mean reverrrrrting, which I'm ambivalent about. The most important thing is it gets logged no matter what--so in this case, there should at least be something in the console... |
@sgress454 it used to only be for |
Hey guys, sails v0.11 Here's link to the repo: The res.body is an empty object. |
@revic1993 Thanks! I cloned your repo and was able to run your test with no issues. I put a
Following what @mikermcneil said, I'd check that you're not somehow setting your environment to "production". In your test, try |
@sgress454 Thanks! I got it..
I guess I should go with my custom response as I have to use api in the production. |
When I try to test the controllers using mocha I am getting an empty response body.
EDIT :
I have created this custom response which is working fine. But I still haven't figured out why the inbuilt responses are not working.
The text was updated successfully, but these errors were encountered: