Skip to content

Commit f02d81a

Browse files
committed
add headers
1 parent 9722693 commit f02d81a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

titiler/stacapi/factory.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,23 @@ def web_map_tile_service( # noqa: C901
791791
add_mask=True,
792792
)
793793

794+
headers: Dict[str, str] = {}
795+
if image.bounds is not None:
796+
headers["Content-Bbox"] = ",".join(map(str, image.bounds))
797+
if uri := CRS_to_uri(image.crs):
798+
headers["Content-Crs"] = f"<{uri}>"
799+
800+
if (
801+
OptionalHeader.server_timing in self.optional_headers
802+
and image.metadata.get("timings")
803+
):
804+
headers["Server-Timing"] = ", ".join(
805+
[
806+
f"{name};dur={time}"
807+
for (name, time) in image.metadata["timings"]
808+
]
809+
)
810+
794811
return Response(content, media_type=media_type)
795812

796813
###################################################################

0 commit comments

Comments
 (0)