Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of method decorators is not arbitrary #284

Open
vonZeppelin opened this issue Nov 16, 2022 · 0 comments
Open

Order of method decorators is not arbitrary #284

vonZeppelin opened this issue Nov 16, 2022 · 0 comments

Comments

@vonZeppelin
Copy link

Describe the bug
The decorator that specifies HTTP method and URI must be the "closest" to a Consumer method in order to the rest of decorators have any effect.

To Reproduce

class ApiConsumer(Consumer):
    # Content-Type header WILL be set
    @headers({"Content-Type": "text/plain"})
    @post("foo")
    def foo(self, file: Body):
        ...

    # Content-Type header WILL NOT be set
    @post("bar")
    @headers({"Content-Type": "text/plain"})
    def bar(self, file: Body):
        ...

Expected behavior
Order of decorators doesn't matter OR documentation explicitly states that @http_method decorator must be the "last" one.

Additional context
All code examples actually have @http_method decorator applied last, but I couldn't find mentions of importance of that 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant