Skip to content

Commit

Permalink
Fix request header not passed on cached extractor response & support …
Browse files Browse the repository at this point in the history
…HEAD method to video endpoint
  • Loading branch information
mhdzumair committed Nov 17, 2024
1 parent f69b67d commit 641fd17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mediaflow_proxy/routes/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand All @@ -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))
Expand Down

0 comments on commit 641fd17

Please sign in to comment.