Git Product home page Git Product logo

Comments (5)

emilymdubois avatar emilymdubois commented on September 26, 2024

@davidtheclark you definitely have access to the $context variable since it's currently being used in the request template to pass the HTTP method back to the Lambda function. This should be possible with something like:

'application/json': "{\"headers\":\"$input.params()\",\"ip\":\"$context.identity.sourceIp\",\"method\":\"$context.httpMethod\",\"body\":$input.json('$')}" 

⚠️ You may not notice your new ip property being returned if you perform a simple CloudFormation update. It may require deleting and recreating your stack in order to see your changes until #9 lands.

from deprecated-hookshot.

davidtheclark avatar davidtheclark commented on September 26, 2024

@emilymdubois: I can do this with my own CloudFormation resources, but if I'm using hookshot to create the API Gateway, I'd need to sneak in and mutate the object that hookshot returned in order to change that line of code, right?

I wonder if a parameter should be added to hookshot allowing the user to specify other things that should show up in the response body JSON.

from deprecated-hookshot.

rclark avatar rclark commented on September 26, 2024

@emilymdubois do you have an example of how we could change https://github.com/mapbox/hookshot/blob/master/index.js#L175 to expose the entire context object on .passthrough()?

This would be nice to roll up into a breaking version alongside #11

from deprecated-hookshot.

emilymdubois avatar emilymdubois commented on September 26, 2024

@rclark I haven't experimented with passing the entire $context object back. I only did this with the $input variable, and I think 18a0256 was on the right track.

from deprecated-hookshot.

rclark avatar rclark commented on September 26, 2024

I think the next thing to investigate is the API Gateway proxy integration, which is designed to be a direct passthrough from an HTTP request to a lambda function.

from deprecated-hookshot.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.