GithubHelp home page GithubHelp logo

asottile-archive / api-gateway-v2-to-wsgi Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 3.0 178 KB

translation from the aws api gateway v2.0 lambda event to wsgi

License: MIT License

Python 88.61% HCL 11.39%
api-gateway-v2 aws lambda serverless

api-gateway-v2-to-wsgi's People

Contributors

asottile avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

api-gateway-v2-to-wsgi's Issues

Can't set multiple cookies

I just finished upgrading my similar package apig-wsgi to support v2. I used this library as reference. On the way I spotted a bug - the set-cookie header in responses does work, but if a response sets more than one cookie, you can only have one header, so the other cookies will get dropped. You need to pull the cookie headers out into the cookies return array.

Additionally ths library isn't returning the full response object (doc'd at bottom of this page), I'm not sure if there are potential issues there e.g. api gateway may try and infer if response content is base64 encoded (not documented ofc).

Event format has changed

Hi -- I attempted to use this library yesterday and wanted to point out some issues that I encountered. These were both easy fixes and I like the lightweight nature of this library. I hesitated to open a PR or fork because I saw this was updated as recently as yesterday so figured it must be working for somebody.

  1. This line causes an issue when body is set to None on the event (can't call encode None on line 69)
body_b = body.encode() if body else b'' # will do the trick on 69
  1. The event structure seems to have changed in other ways too.
    • rawPath is now path
    • rawQueryString may not be present
    • request context no longer has an http key, now has an identity key
    • headers are not called multiValueHeaders
    • there are a lot of these type of changes, I won't enumerate them all

If others are running into the same issue I'll open a PR with the changes; if some are still using this successfully (perhaps for older versions of API v2?) I can open a PR that supports looking for keys in both formats.

binary responses are not supported

presumably this is easy to implement I just didn't do it

my guess is that you'd put some code here and encode the response and set isBase64Encoded in the response

I didn't need this for my use case so I didn't implement it

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.