|
1 | | -from typing import Optional |
| 1 | +from ..internal.utils.deprecation import deprecation |
| 2 | +from ._utils import from_wsgi_header # noqa |
| 3 | +from ._utils import get_wsgi_header # noqa |
2 | 4 |
|
3 | | -from ddtrace.internal.utils.cache import cached |
4 | 5 |
|
5 | | - |
6 | | -@cached() |
7 | | -def get_wsgi_header(header): |
8 | | - # type: (str) -> str |
9 | | - """Returns a WSGI compliant HTTP header. |
10 | | - See https://www.python.org/dev/peps/pep-3333/#environ-variables for |
11 | | - information from the spec. |
12 | | - """ |
13 | | - return "HTTP_{}".format(header.upper().replace("-", "_")) |
14 | | - |
15 | | - |
16 | | -@cached() |
17 | | -def from_wsgi_header(header): |
18 | | - # type: (str) -> Optional[str] |
19 | | - """Convert a WSGI compliant HTTP header into the original header. |
20 | | - See https://www.python.org/dev/peps/pep-3333/#environ-variables for |
21 | | - information from the spec. |
22 | | - """ |
23 | | - HTTP_PREFIX = "HTTP_" |
24 | | - # PEP 333 gives two headers which aren't prepended with HTTP_. |
25 | | - UNPREFIXED_HEADERS = {"CONTENT_TYPE", "CONTENT_LENGTH"} |
26 | | - |
27 | | - if header.startswith(HTTP_PREFIX): |
28 | | - header = header[len(HTTP_PREFIX) :] |
29 | | - elif header not in UNPREFIXED_HEADERS: |
30 | | - return None |
31 | | - return header.replace("_", "-").title() |
| 6 | +deprecation( |
| 7 | + name="ddtrace.propagation.utils", |
| 8 | + message="This module will be removed in v1.0.", |
| 9 | + version="1.0.0", |
| 10 | +) |
0 commit comments