MCPcopy
hub / github.com/pallets/werkzeug / unquote_header_value

Function unquote_header_value

src/werkzeug/http.py:177–193  ·  view source on GitHub ↗

Remove double quotes and backslash escapes from a header value. This is the reverse of :func:`quote_header_value`. :param value: The header value to unquote. .. versionchanged:: 3.2 Removes escape preceding any character. .. versionchanged:: 3.0 The ``is_filename`

(value: str)

Source from the content-addressed store, hash-verified

175
176
177def unquote_header_value(value: str) -> str:
178 """Remove double quotes and backslash escapes from a header value.
179
180 This is the reverse of :func:`quote_header_value`.
181
182 :param value: The header value to unquote.
183
184 .. versionchanged:: 3.2
185 Removes escape preceding any character.
186
187 .. versionchanged:: 3.0
188 The ``is_filename`` parameter is removed.
189 """
190 if len(value) >= 2 and value[0] == value[-1] == '"':
191 return _unslash_re.sub(r"\g<1>", value[1:-1])
192
193 return value
194
195
196def dump_options_header(header: str | None, options: t.Mapping[str, t.Any]) -> str:

Callers 2

parse_list_headerFunction · 0.85
parse_dict_headerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected