question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for decorators

See original GitHub issue

I’ve seen in the past people were talking about having support for decorators instead of being stuck with just CORS_URLS_REGEX

I’d like to re-open the request to support decorators so that it’s very easy to limit CORS responses to specific views.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
simonwcommented, Mar 8, 2021

Another vote for this here: I run the Django admin on a domain that also hosts a couple of API endpoints. I want to allow CORS for those endpoints, and I was hoping I could do it with a view decorator rather than having to add a middleware that affects every request to my site.

I’ll use CORS_URLS_REGEX for the moment (somehow I didn’t spot that when scanning the README earlier but it turns out it’s documented there, I just missed it).

1reaction
danlamannacommented, Jul 18, 2019

Coming from the flask world I feel the same. Working with a single regular expression to convey your rules is a bit clunky, I would much rather decorate an endpoint with specific options.

This is the decorator I typically use with flask-cors: https://flask-cors.readthedocs.io/en/latest/api.html#decorator. It enables setting any of those options per endpoint.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Experimental decorators warning in TypeScript compilation
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to ...
Read more >
Solving warning: “Experimental support for decorators is a ...
This article describes how to solve this warning that could be shown after use “decorators” in TypeScript. WHAT IS A DECORATOR. A “decorator”...
Read more >
Experimental support for decorators is a feature that is subject ...
To solve the error "Experimental support for decorators is a feature that is subject to change in a future release", make sure to...
Read more >
Error warning message: "Experimental support for decorators ...
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to ...
Read more >
How to remove experimentalDecorators warning in VSCode
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found