Use constants for HTTP headers (#10313)
* Use constants for HTTP headers * Fix ordering * Move 'no-cache' to platform
This commit is contained in:
1 parent
e64803e701
commit
de9d19d6f4
36 files changed
+408
-444
No files matched your search
@@ -5,37 +5,43 @@ For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/http/
|
||||
"""
|
||||
import asyncio
|
||||
import json
|
||||
from functools import wraps
|
||||
import logging
|
||||
import ssl
|
||||
from ipaddress import ip_network
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import voluptuous as vol
|
||||
from aiohttp import web
|
||||
from aiohttp.web_exceptions import HTTPUnauthorized, HTTPMovedPermanently
|
||||
import ssl
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.hdrs import ACCEPT, ORIGIN, CONTENT_TYPE
|
||||
from aiohttp.web_exceptions import HTTPUnauthorized, HTTPMovedPermanently
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
SERVER_PORT, CONTENT_TYPE_JSON, HTTP_HEADER_HA_AUTH,
|
||||
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_START,
|
||||
HTTP_HEADER_X_REQUESTED_WITH)
|
||||
from homeassistant.core import is_callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.remote as rem
|
||||
import homeassistant.util as hass_util
|
||||
from homeassistant.const import (
|
||||
SERVER_PORT, CONTENT_TYPE_JSON, ALLOWED_CORS_HEADERS,
|
||||
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_START)
|
||||
from homeassistant.core import is_callback
|
||||
from homeassistant.util.logging import HideSensitiveDataFilter
|
||||
|
||||
from .auth import auth_middleware
|
||||
from .ban import ban_middleware
|
||||
from .const import (
|
||||
KEY_USE_X_FORWARDED_FOR, KEY_TRUSTED_NETWORKS, KEY_BANS_ENABLED,
|
||||
KEY_LOGIN_THRESHOLD, KEY_AUTHENTICATED)
|
||||
KEY_BANS_ENABLED, KEY_AUTHENTICATED, KEY_LOGIN_THRESHOLD,
|
||||
KEY_TRUSTED_NETWORKS, KEY_USE_X_FORWARDED_FOR)
|
||||
from .static import (
|
||||
staticresource_middleware, CachingFileResponse, CachingStaticResource)
|
||||
CachingFileResponse, CachingStaticResource, staticresource_middleware)
|
||||
from .util import get_real_ip
|
||||
|
||||
REQUIREMENTS = ['aiohttp_cors==0.5.3']
|
||||
|
||||
ALLOWED_CORS_HEADERS = [
|
||||
ORIGIN, ACCEPT, HTTP_HEADER_X_REQUESTED_WITH, CONTENT_TYPE,
|
||||
HTTP_HEADER_HA_AUTH]
|
||||
|
||||
DOMAIN = 'http'
|
||||
|
||||
CONF_API_PASSWORD = 'api_password'
|
||||
|
||||
Reference in new issue
Block a user