Request
Mutable representation of an outgoing HTTP request issued by the native player (for example a DRM license or certificate request).
Instances are created by the SDK and handed to request modifiers — such as a
DrmRequestModifier or a custom modifier registered with the
DrmEnvironmentAdapter — which may inspect or mutate the request before it
is sent. Any call to setUrl, setHeaders
or setBody marks the request as dirty
(see isDirty); the SDK then forwards the modified
URL, headers and body to the native layer. If no setter is called the
request is sent unchanged.
Applications should not construct Request instances directly.
Methods
getId()
getId():
string
Returns the opaque identifier that correlates this request with its eventual Response and with the underlying native request.
Returns
string
getType()
getType():
ResourceType
Returns the kind of resource being requested (e.g. a DRM license).
Returns
getMethod()
getMethod():
RequestMethod
Returns the HTTP method of the request. The method is fixed at the time the request is created by the native layer and cannot be changed.
Returns
isDirty()
isDirty():
boolean
Returns true if any of setUrl,
setHeaders or setBody
has been called on this request, in which case the SDK will forward the
modified values to the native layer.
Returns
boolean
getUrl()
getUrl():
string
Returns the current target URL of the request.
Returns
string
setUrl()
setUrl(
url):void
Replaces the target URL of the request and marks it as dirty.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The new fully-qualified URL. |
Returns
void
getHeaders()
getHeaders():
Record<string,string>
Returns the current request headers as a plain object. The returned object is the live backing store — mutating it directly will not mark the request as dirty; use setHeaders instead.
Returns
Record<string, string>
setHeaders()
setHeaders(
headers):void
Replaces the request headers and marks the request as dirty. The provided map fully replaces any previously set headers.
Parameters
| Parameter | Type | Description |
|---|---|---|
headers | Record<string, string> | The complete set of headers to send with the request. |
Returns
void
getBody()
getBody():
Uint8Array
Returns the current request body as a byte buffer. For GET requests
this will typically be an empty buffer.
Returns
setBody()
setBody(
body):void
Replaces the request body and marks the request as dirty.
Parameters
| Parameter | Type | Description |
|---|---|---|
body | Uint8Array | The raw bytes to send as the request body. |
Returns
void