@data-fair/lib-node 1.3.0 → 1.3.1

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.
Files changed (2) hide show
  1. package/axios-auth.js +3 -3
  2. package/package.json +1 -1
package/axios-auth.js CHANGED
@@ -25,9 +25,9 @@ export async function axiosAuth (opts) {
25
25
  await axiosInstance.get(callbackUrl, { maxRedirects: 0 })
26
26
  } catch (err) {
27
27
  if (err.status !== 302) { throw err }
28
- /* axiosOpts.headers = axiosOpts.headers ?? {}
29
- axiosOpts.headers.common = axiosOpts.headers.common ?? {}
30
- axiosOpts.headers.common.Cookie = err.headers['set-cookie'].map((s: string) => s.split(';')[0]).join(';') */
28
+ const redirectUrl = new URL(err.headers.location)
29
+ const redirectError = redirectUrl.searchParams.get('error')
30
+ if (redirectError) { throw new Error(redirectError) }
31
31
  for (const cookie of err.headers['set-cookie']) { cookieJar.setCookie(cookie, origin) }
32
32
  }
33
33
  const ax = axiosBuilder(axiosOpts, (ax) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-node",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Small nodejs related utility functions for the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [