Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conditional headers #817

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

# [3.13.28] - 20-06-2024

### Fixes

- Send authorization header for `getSignedMediaToken` conditionally

# [3.13.27] - 19-06-2024

### Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inplayer-org/inplayer.js",
"version": "3.13.27",
"version": "3.13.28",
"author": "InPlayer",
"license": "MIT",
"description": "A Javascript SDK for Inplayer's RESTful API",
Expand Down
16 changes: 7 additions & 9 deletions src/endpoints/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
GetAssetsInPackage,
GetItemAccessV1,
GetMerchantPackage,
ItemDetailsV1,
RequestDataCaptureAccessData,
SignedMediaResponse,
SiteEntitlementsResponse
Expand Down Expand Up @@ -586,7 +585,7 @@
const browserFingerprint = Fingerprint2.x64hash128(
reduce(
browserDetails,
(acc: string, details: Record<string, any>) => `${acc}${details.value}`,

Check warning on line 588 in src/endpoints/asset.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected any. Specify a different type

Check warning on line 588 in src/endpoints/asset.ts

View workflow job for this annotation

GitHub Actions / Build

Unexpected any. Specify a different type
''
),
31
Expand Down Expand Up @@ -849,23 +848,22 @@
mediaId: string
): Promise<AxiosResponse<SignedMediaResponse>> {
const tokenObject = await this.request.getToken();
const headers: Record<string, string> = {};

if (tokenObject.token) {
headers.Authorization = `Bearer ${tokenObject.token}`;
}

return this.request.get(API.getSignedMediaToken(appConfigId, mediaId), {
headers: {
Authorization: `Bearer ${tokenObject.token}`
}
headers
});
}

async getSiteEntitlements(
siteId: string
): Promise<AxiosResponse<SiteEntitlementsResponse>> {
const tokenObject = await this.request.getToken();

const headers: Record<string, string> = {
Accept: 'application/json',
'Content-Type': 'application/json'
};
const headers: Record<string, string> = {};

if (tokenObject.token) {
headers.Authorization = `Bearer ${tokenObject.token}`;
Expand Down
Loading