• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alorence / django-modern-rpc / 18550277656

16 Oct 2025 04:26AM UTC coverage: 98.998%. Remained the same
18550277656

push

github

alorence
Update docs

166 of 166 branches covered (100.0%)

1383 of 1397 relevant lines covered (99.0%)

27.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
modernrpc/compat.py
1
import functools
28✔
2

3
import django
28✔
4
from django.http import HttpResponseNotAllowed
28✔
5
from django.utils.log import log_response
28✔
6
from django.views.decorators.csrf import csrf_exempt
28✔
7
from django.views.decorators.http import require_POST
28✔
8

9
if django.VERSION >= (5, 0):
28✔
10
    # Django updated its decorators to support wrapping asynchronous method in release 5.0
11
    # REF: https://docs.djangoproject.com/en/5.2/releases/5.0/#decorators
12

13
    async_csrf_exempt = csrf_exempt
13✔
14
    async_require_post = require_POST
13✔
15

16
else:
17
    # Fore Django version < 5.0, we partially redefine decorators to support async view
18

19
    def async_csrf_exempt(view):
15✔
20
        view.csrf_exempt = True
15✔
21
        return view
15✔
22

23
    def async_require_post(func):
15✔
24
        @functools.wraps(func)
15✔
25
        async def inner(request, *args, **kwargs):
15✔
26
            if request.method != "POST":
15✔
27
                response = HttpResponseNotAllowed([""])
15✔
28
                log_response(
15✔
29
                    "Method Not Allowed (%s): %s",
30
                    request.method,
31
                    request.path,
32
                    response=response,
33
                    request=request,
34
                )
35
                return response
15✔
36
            return await func(request, *args, **kwargs)
15✔
37

38
        return inner
15✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc