@data-fair/lib-node 2.0.1 → 2.0.3

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/axios-auth.js CHANGED
@@ -28,11 +28,12 @@ export async function axiosAuth (opts) {
28
28
  const redirectUrl = new URL(err.headers.location)
29
29
  const redirectError = redirectUrl.searchParams.get('error')
30
30
  if (redirectError) { throw new Error(redirectError) }
31
- for (const cookie of err.headers['set-cookie']) { cookieJar.setCookie(cookie, origin) }
31
+ for (const cookie of err.headers['set-cookie'] ?? []) { cookieJar.setCookie(cookie, origin) }
32
32
  }
33
33
  const ax = axiosBuilder(axiosOpts, (ax) => {
34
34
  ax.interceptors.request.use(async (config) => {
35
- config.headers.Cookie = await cookieJar.getCookies(origin)
35
+ const url = (config.baseURL && config.url?.startsWith('/')) ? (config.baseURL + config.url) : config.url
36
+ config.headers.Cookie = await cookieJar.getCookies(url ?? origin)
36
37
  return config
37
38
  })
38
39
  ax.interceptors.response.use(async (res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-node",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Small nodejs related utility functions for the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [
package/mongo-types.js DELETED
@@ -1 +0,0 @@
1
- export {}