@audius/sdk 1.0.6-beta.1 → 1.0.6-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audius/sdk",
3
- "version": "1.0.6-beta.1",
3
+ "version": "1.0.6-beta.2",
4
4
  "audius": {
5
5
  "releaseSHA": "e85874b984816113090067e11a5524462622f3cf"
6
6
  },
package/src/api/File.ts CHANGED
@@ -44,7 +44,8 @@ export class File extends Base {
44
44
  creatorNodeGateways: string[],
45
45
  callback: Nullable<(url: string) => void> = null,
46
46
  responseType: ResponseType = 'blob',
47
- trackId = null
47
+ trackId = null,
48
+ premiumContentHeaders = {}
48
49
  ) {
49
50
  const urls: string[] = []
50
51
 
@@ -63,19 +64,20 @@ export class File extends Base {
63
64
  callback!,
64
65
  {
65
66
  method: 'get',
66
- responseType
67
+ responseType,
68
+ ...premiumContentHeaders
67
69
  },
68
70
  /* timeout */ null
69
71
  )
70
72
 
71
73
  if (!response) {
72
- const allUnauthorized = errored.every(
74
+ const allForbidden = errored.every(
73
75
  // @ts-expect-error not valid axios error
74
76
  (error) => error.response.status === 403
75
77
  )
76
- if (allUnauthorized) {
78
+ if (allForbidden) {
77
79
  // In the case for a 403, do not retry fetching
78
- bail(new Error('Unauthorized'))
80
+ bail(new Error('Forbidden'))
79
81
  return
80
82
  }
81
83
  throw new Error(`Could not fetch ${cid}`)
@@ -99,6 +101,7 @@ export class File extends Base {
99
101
  {
100
102
  method: 'get',
101
103
  responseType
104
+ // todo: Do we need to also set the premium content headers in this legacy flow?
102
105
  },
103
106
  /* timeout */ null
104
107
  )