beer-network 1.2.9 → 1.2.10

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.
@@ -8,6 +8,6 @@ type CookiesLike = {
8
8
  getAll?: () => Array<any>;
9
9
  has?: (name: string) => boolean;
10
10
  };
11
- export declare function getNodeHeaders(): HeadersLike;
11
+ export declare function getNodeHeaders(): Promise<HeadersLike>;
12
12
  export declare function getNodeCookies(): CookiesLike;
13
13
  export {};
@@ -29,15 +29,17 @@ function emptyCookies() {
29
29
  }
30
30
  };
31
31
  }
32
- export function getNodeHeaders() {
32
+ export async function getNodeHeaders() {
33
33
  const mod = loadNextHeadersModule();
34
- if (mod?.headers)
34
+ if (mod?.headers) {
35
35
  return mod.headers();
36
+ }
36
37
  return emptyHeaders();
37
38
  }
38
39
  export function getNodeCookies() {
39
40
  const mod = loadNextHeadersModule();
40
- if (mod?.cookies)
41
+ if (mod?.cookies) {
41
42
  return mod.cookies();
43
+ }
42
44
  return emptyCookies();
43
45
  }
package/api.js CHANGED
@@ -294,7 +294,7 @@ export default class Fetch {
294
294
  return undefined;
295
295
  }
296
296
  if (this.isNextJS === true) {
297
- const nodeHeaders = getNodeHeaders();
297
+ const nodeHeaders = await getNodeHeaders();
298
298
  return nodeHeaders.get('x-access-token')
299
299
  ?? nodeHeaders.get('access-token')
300
300
  ?? nodeHeaders.get('authorization')
@@ -304,7 +304,7 @@ export default class Fetch {
304
304
  }
305
305
  if (this.isNextJS === undefined) {
306
306
  try {
307
- getNodeHeaders();
307
+ await getNodeHeaders();
308
308
  this.isNextJS = true;
309
309
  }
310
310
  catch {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beer-network",
3
3
  "private": false,
4
- "version": "1.2.9",
4
+ "version": "1.2.10",
5
5
  "scripts": {
6
6
  "pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
7
7
  "pub-m": "tsc && cp package.json ./dist/package.json && npm publish ./dist"