You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no reason actions that serve static views should have to worry about defining a fn: function (inputs, exits) { return exits.success(); } just to make some stupid header go away. So now, the X-Stub header is only automatically attached to responses if fake example data is being generated and sent to the response. Also, now anytime we add a X-Stub header, if you're in production (process.env.NODE_ENV==='production') we also log a warning to the console.
Somtimes it's nice to be able to send runtime output through a void exit. Like, especially if it's an Error instance. This makes it possible to have nice-looking stack traces, dynamic error messages, and supplemetary info that isn't built into the static response/exit definition. This has worked in the machine runner for a long time, but up until now machine-as-action was being a real big fuddy duddy. So we did some stuff. And now, if you send output through a void exit at runtime (e.g. exits.notFound(new Error('Now where did I put those '+pluralize(cookieStyle)+'?'));), that output will be logged to the console. It will still never get included in the response, because that would a security nightmare.
By "void exit", we mean an exit with an undefined outputExample.
Errors(/any other unexpected output) are logged to the console using sails.log.warn() if available. Otherwise, machine-as-action falls back to using console.warn().
To use your own custom logger instead, pass in a log function via the new logUnexpectedOutputFn option.
Speaking of options, we updated documentation in README.md to include all available options.