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 + } + } +} + +``` +