-
Notifications
You must be signed in to change notification settings - Fork 8
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
Invalid response when body is empty #55
Comments
Hey @Dennor! It seems that here the issue is not with the response being empty but with returning it from a Promise. This should work without |
import Server from 'syncano-server';
export default async ctx => {
const {response} = Server(ctx);
return response('text', 200, 'text/plain', {});
}; With code like this, the response I'm getting is:
I'm using syncano-cli@beta by the way, so async gets transpiled away. |
As I mentioned in above comment - |
import Server from 'syncano-server';
export default ctx => {
const {response} = Server(ctx);
return response('', 200, 'text/plain', {});
}; Still getting:
As I've said, every other response, except for response with empty body, as in:
is returning, what it's supposed to be returning. When the body is empty I'm getting execution context state. Tested just now both, with and without async keyword. |
You are right. Turns out that both handling |
@Dennor @23doors I've removed content check as suggested in Syncano/syncano-server-js#99 . It will now always call underneath setResponse. I guess that resolves this issue. Right @Dennor ? |
Expected behaviour
When response is returned and is empty, it should stay empty.
Actual behaviour
Steps to reproduce
socket.yml
src/fail-case.js
package.json
Details
npx s version
When script returns an empty response, it replaces it with script execution info. Sometimes empty response is an expected behaviour. It can be useful for application/octet-stream and text/plain content-type responses, but it also fails at empty application/json.
The text was updated successfully, but these errors were encountered: