From 641fd17be843f9382de5c00b4c6d42e6da0fc384 Mon Sep 17 00:00:00 2001 From: mhdzumair Date: Sun, 17 Nov 2024 20:18:46 +0530 Subject: [PATCH] Fix request header not passed on cached extractor response & support HEAD method to video endpoint --- mediaflow_proxy/routes/extractor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mediaflow_proxy/routes/extractor.py b/mediaflow_proxy/routes/extractor.py index 3bd757e..6960008 100644 --- a/mediaflow_proxy/routes/extractor.py +++ b/mediaflow_proxy/routes/extractor.py @@ -19,6 +19,7 @@ logger = logging.getLogger(__name__) +@extractor_router.head("/video") @extractor_router.get("/video") async def extract_url( extractor_params: Annotated[ExtractorURLParams, Query()], @@ -33,6 +34,8 @@ async def extract_url( extractor = ExtractorFactory.get_extractor(extractor_params.host, proxy_headers.request) response = await extractor.extract(extractor_params.destination, **extractor_params.extra_params) await set_cache_extractor_result(cache_key, response) + else: + response["request_headers"].update(proxy_headers.request) response["mediaflow_proxy_url"] = str( request.url_for(response.pop("mediaflow_endpoint")).replace(scheme=get_original_scheme(request))