Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Context.fail does not support custom status codes #4

Open
kturcios opened this issue Mar 3, 2019 · 0 comments · May be fixed by #5
Open

Context.fail does not support custom status codes #4

kturcios opened this issue Mar 3, 2019 · 0 comments · May be fixed by #5

Comments

@kturcios
Copy link
Contributor

kturcios commented Mar 3, 2019

Expected Behaviour

The following code snippet should return a 501 status code along with the error message.

module.exports = (event, context) => {
    context
        .status(501)
        .fail('An error occurred');
}

Current Behaviour

The snippet is returning the default 500 status code along with the error message.

Possible Solution

Modify the fail method inside index.js to use this.value

fail(value) {
        let message;
        this.cb(this.value, message);
}

Steps to Reproduce (for bugs)

Create a handler that returns the following

module.exports = (event, context) => {
    context
        .status(501)
        .fail('An error occurred');
}

Context

I am trying to create a stateless microservice that returns proper status codes.

Your Environment

faas-cli version: 0.8.3
docker version: 18.09.1
OS: MacOS

@kturcios kturcios linked a pull request Mar 4, 2019 that will close this issue
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant