mirror of
https://github.com/jellyfin/jellyfin-sdk-typescript.git
synced 2024-11-23 05:59:44 +00:00
Fix model property capitalization
This commit is contained in:
parent
fc9fc0bc35
commit
8c6f3c8a54
@ -22,9 +22,9 @@ export class Jellyfin {
|
||||
deviceInfo;
|
||||
|
||||
constructor(
|
||||
clientInfo: ClientInfo = { Name: 'jellyfin-sdk-typescript', Version: 'v0.1.0' },
|
||||
clientInfo: ClientInfo = { name: 'jellyfin-sdk-typescript', version: 'v0.1.0' },
|
||||
// FIXME: The device info should always be required.
|
||||
deviceInfo: DeviceInfo = { Name: 'device-name', Id: 'device-id' }
|
||||
deviceInfo: DeviceInfo = { name: 'device-name', id: 'device-id' }
|
||||
) {
|
||||
this.clientInfo = clientInfo;
|
||||
this.deviceInfo = deviceInfo;
|
||||
|
@ -8,6 +8,6 @@
|
||||
* An interface representing a client application.
|
||||
*/
|
||||
export interface ClientInfo {
|
||||
Name: string,
|
||||
Version: string
|
||||
name: string,
|
||||
version: string
|
||||
}
|
||||
|
@ -8,6 +8,6 @@
|
||||
* An interface representing a client device.
|
||||
*/
|
||||
export interface DeviceInfo {
|
||||
Id: string,
|
||||
Name: string
|
||||
id: string,
|
||||
name: string
|
||||
}
|
||||
|
@ -8,22 +8,22 @@ import { getAuthorizationHeader } from '..';
|
||||
describe('Authentication', () => {
|
||||
it('should return the correct header value without token', () => {
|
||||
const header = getAuthorizationHeader({
|
||||
Name: 'SDK Test',
|
||||
Version: '0.0.0'
|
||||
name: 'SDK Test',
|
||||
version: '0.0.0'
|
||||
}, {
|
||||
Name: 'Test Device',
|
||||
Id: 'TESTID'
|
||||
name: 'Test Device',
|
||||
id: 'TESTID'
|
||||
});
|
||||
expect(header).toEqual('MediaBrowser Client="SDK Test", Device="Test Device", DeviceId="TESTID", Version="0.0.0", Token=""');
|
||||
});
|
||||
|
||||
it('should return the correct header value with token', () => {
|
||||
const header = getAuthorizationHeader({
|
||||
Name: 'SDK Test',
|
||||
Version: '0.0.0'
|
||||
name: 'SDK Test',
|
||||
version: '0.0.0'
|
||||
}, {
|
||||
Name: 'Test Device',
|
||||
Id: 'TESTID'
|
||||
name: 'Test Device',
|
||||
id: 'TESTID'
|
||||
}, 'TESTTOKEN');
|
||||
expect(header).toEqual('MediaBrowser Client="SDK Test", Device="Test Device", DeviceId="TESTID", Version="0.0.0", Token="TESTTOKEN"');
|
||||
});
|
||||
|
@ -11,10 +11,10 @@ import { ClientInfo, DeviceInfo } from '../models';
|
||||
export function getAuthorizationHeader(clientInfo: ClientInfo, deviceInfo: DeviceInfo, accessToken = ''): string {
|
||||
// TODO: We should ensure values are properly escaped
|
||||
return [
|
||||
`MediaBrowser Client="${clientInfo.Name}"`,
|
||||
`Device="${deviceInfo.Name}"`,
|
||||
`DeviceId="${deviceInfo.Id}"`,
|
||||
`Version="${clientInfo.Version}"`,
|
||||
`MediaBrowser Client="${clientInfo.name}"`,
|
||||
`Device="${deviceInfo.name}"`,
|
||||
`DeviceId="${deviceInfo.id}"`,
|
||||
`Version="${clientInfo.version}"`,
|
||||
`Token="${accessToken}"`
|
||||
].join(', ');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user