Git Product home page Git Product logo

aws-lambda-decorators's Issues

Missing extract data can set incorrect name in Parameter class

With this bug it's possible to set a default value for an incorrect key when extracting a parameter. It's also possible for incorrect key names to persist across unit tests when the Parameter object persists across tests (default behaviour in python's unittest).

Testing using extract_from_event with data:

event = {
    "body": "{}"
}

and handler:

@extract_from_event(parameters=[Parameter(path="body[json]/optional/value", default="Hello")])
def handler(event, context, **kwargs):
    return {
        "statusCode": 200,
        "body": json.dumps(kwargs)
    }

The expected body would be {"value": "Hello"}, however the actual response is currently {"optional": "Hello"}

[JWT] Authorization: Bearer <token> support?

When I try to use the standard JWT header:
"Authorization":"bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9....",
it returns me
jwt.exceptions.DecodeError: Invalid header padding
However after I remove "bearer ", then it can decode it, no sweat.
Is there a way that I can support this schema without hacking it?
Thanks.

Cache parent parameters

Add caching to the decoded parameters, so they are only extracted once.

We might want to extract name, email, ... from an event body which comes in as json. We want to extract the json body just once, instead of json load every single time we extract a parameter.

Make decoder caching optional

As introduced in #83 there is a caching mechanism. It would be awesome to make it configurable (disable, enabled by default), because this leads to a really strange behaviour for certain lambda functions.

Unit tests are included in package

After installing v0.48 in a virtual environment, this library's unit tests are included in the lib folder in the virtual environment.

Headers to dict?

Hi,

Love the work you guys have done, this is awesome. I am trying to extract my "Authorization" from my headers (I see you currently do not support Bearer).

I am trying the following:

@extract_from_event(parameters=[

    Parameter(
        path="/headers[json]/Authorization", validators=[Mandatory], var_name="auth")
])

and receiving the following error:

{"message": "Error extracting parameters"}

any ideas?

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.