mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-25 11:09:53 +00:00
16 lines
514 B
Python
16 lines
514 B
Python
"""OpenAPI core contrib django compat module"""
|
|
from openapi_core.contrib.django.backports import (
|
|
HttpHeaders, request_current_scheme_host,
|
|
)
|
|
|
|
|
|
def get_headers(req):
|
|
# in Django 1 headers is not defined
|
|
return req.headers if hasattr(req, 'headers') else \
|
|
HttpHeaders(req.META)
|
|
|
|
|
|
def get_current_scheme_host(req):
|
|
# in Django 1 _current_scheme_host is not defined
|
|
return req._current_scheme_host if hasattr(req, '_current_scheme_host') \
|
|
else request_current_scheme_host(req)
|