Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

middy-autoproxyresponse

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

middy-autoproxyresponse

Middy AutoProxyResponse Middleware

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
504
decreased by-52.36%
Maintainers
1
Weekly downloads
 
Created
Source

Middy AutoProxyResponse Middleware

Copyright (C) Clouden 2018
Author Kenneth Falck kennu@clouden.net 2018

Overview

This Middy middleware lets you return simple JavaScript objects from Lambda function handlers and converts them into LAMBDA_PROXY responses.

When you return a response like this:

  {
    hello: 'world'
  }

The AutoProxyRespose middleware converts it to this:

{
  statusCode: 200,
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    hello: 'world'
  })
}

If your response contains a statusCode attribute, it is not converted, allowing you to return a full LAMBDA_PROXY response manually.

Installation

To add the middleware to your project:

npm install --save middy-autoproxyresponse

To use the middleware in a Lambda function:

import { autoProxyResponse } from 'middy-autoproxyresponse'

async function handler(_event: any, _context: any) {
  return {
    hello: 'world'
  }
}

export default middy(handler)
.use(autoProxyResponse())

FAQs

Package last updated on 27 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc