@lblod/mu-auth-sudo 1.0.0-beta.2 → 1.0.0-beta.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/dist/auth-sudo.js +10 -2
- package/package.json +1 -1
package/dist/auth-sudo.js
CHANGED
|
@@ -61,7 +61,7 @@ async function executeRawQuery(queryString, extraHeaders = {}, connectionOptions
|
|
|
61
61
|
}
|
|
62
62
|
if (DEBUG_AUTH_HEADERS) {
|
|
63
63
|
const stringifiedHeaders = Array.from(headers.entries())
|
|
64
|
-
.filter(([key
|
|
64
|
+
.filter(([key]) => key.startsWith('mu-'))
|
|
65
65
|
.map(([key, value]) => `${key}: ${value}`)
|
|
66
66
|
.join("\n");
|
|
67
67
|
console.log(`Headers set on SPARQL client: ${stringifiedHeaders}`);
|
|
@@ -87,7 +87,7 @@ async function executeRawQuery(queryString, extraHeaders = {}, connectionOptions
|
|
|
87
87
|
headers
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
-
return await response
|
|
90
|
+
return await maybeJSON(response);
|
|
91
91
|
}
|
|
92
92
|
catch (ex) {
|
|
93
93
|
if (mayRetry(ex, attempt, connectionOptions)) {
|
|
@@ -104,6 +104,14 @@ async function executeRawQuery(queryString, extraHeaders = {}, connectionOptions
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
async function maybeJSON(response) {
|
|
108
|
+
try {
|
|
109
|
+
return (await response.json());
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
107
115
|
function querySudo(queryString, extraHeaders = {}, connectionOptions = {}) {
|
|
108
116
|
if (LOG_SPARQL_QUERIES) {
|
|
109
117
|
console.log(queryString);
|
package/package.json
CHANGED