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

Method check_headers

src/werkzeug/middleware/lint.py:349–374  ·  view source on GitHub ↗
(self, headers: Headers)

Source from the content-addressed store, hash-verified

347 return status_code, headers_obj
348
349 def check_headers(self, headers: Headers) -> None:
350 etag = headers.get("etag")
351
352 if etag is not None:
353 if etag.startswith(("W/", "w/")):
354 if etag.startswith("w/"):
355 warn(
356 "Weak etag indicator should be upper case.",
357 HTTPWarning,
358 stacklevel=4,
359 )
360
361 etag = etag[2:]
362
363 if not (etag[:1] == etag[-1:] == '"'):
364 warn("Unquoted etag emitted.", HTTPWarning, stacklevel=4)
365
366 location = headers.get("location")
367
368 if location is not None:
369 if not urlparse(location).netloc:
370 warn(
371 "Absolute URLs required for location header.",
372 HTTPWarning,
373 stacklevel=4,
374 )
375
376 def check_iterator(self, app_iter: t.Iterable[bytes]) -> None:
377 if isinstance(app_iter, str):

Callers 1

check_start_responseMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected