From 29910a26981dfbe4a30830ed192a1fd53a819a8f Mon Sep 17 00:00:00 2001 From: Stefan <84-stefan@users.noreply.gitlab.futo.org> Date: Thu, 31 Jul 2025 14:00:17 +0000 Subject: [PATCH] docs: add section for Request Modifiers in Content types document --- docs/Content Types.md | 48 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/Content Types.md b/docs/Content Types.md index 660e9855..8f0441b5 100644 --- a/docs/Content Types.md +++ b/docs/Content Types.md @@ -70,7 +70,7 @@ A feed object representing a community post with text, and optionally images. *Usage:* ```javascript -new PlatformPost{ +new PlatformPost({ id: new PlatformID(config.name, item?.id, config.id), name: item?.attributes?.title, author: getPlatformAuthorLink(item, context), @@ -276,4 +276,50 @@ new PlatformPostDetails{ }); ``` +# Request Modifiers +Sources support request modifiers that allow to modify HTTP headers before sending requests. This is useful when a source requires specific headers for authentication, content type specification, or other requirements. + +## Using requestModifier property + +``` +new HLSSource({ +    //Your other properties... +    requestModifier: { +        headers: { +            "Referer": "https://www.example.com/", +            "Origin": "https://www.example.com" +        } +    } +}) +``` + +## Custom source implementation + +``` +class YourAudioSource extends AudioUrlRangeSource { + constructor(obj) { + super(obj); + } + + getRequestModifier() { + return new YourRequestModifier(); + } +} + +class YourRequestModifier extends RequestModifier { + constructor() { + super(); + } + modifyRequest(url, headers) { + //modify headers + + return { + url: url, + headers: headers + } + } +} + +``` +