Returning a 201 with serverless 1.x

Is there a way to specify a 201 response code instead of a 200 for certain endpoints?

Based on the guide (, it seems like this should be possible, but looking at the underlying code, it looks like the 200 response mapping is hard coded (

I was expecting to be able to do something like:

    handler: myEvent.handler
      - http:
          path: path/to/myEvent
          method: put
              Content-Type: "'text/html'"
            template: $input.path('$')
                pattern: ''

Is this at all possible or should I just wait for the new HTTP response support via the Lambda proxy integration? (

When I looked at the source I also concluded that the 200 response was hard coded. Have a look at as it might help you for now.

It looks like the master branch now has support for the lambda-proxy integration type. If you don’t mind your Lambda understanding HTTP then you can use that to send back a 201 :slight_smile:

Yeah my preference is to use the new lambda-proxy integration. Now that’s in master, I assume it’ll be a part of the next release candidate, so I’ll pick it up then.

1 Like

The master has now been released as 1.0 so you’re good to go with the proxy

1 Like