Skip to content

Commit ec65125

Browse files
authored
Set Authorization header from slash API key field and use dql content-type (#356)
1 parent 5532fc5 commit ec65125

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: client/src/lib/helpers.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ export function humanizeBytes(space) {
6767
}
6868

6969
let dgraphServerUrl = getDefaultUrl();
70-
const clientStubOptions = { headers: {} };
70+
const clientStubOptions = {
71+
headers: {
72+
"Content-Type": "application/dql",
73+
},
74+
};
7175

7276
const createDgraphClient = memoizeOne(async url => {
7377
const stub = new dgraph.DgraphClientStub(
@@ -100,11 +104,11 @@ export async function setCurrentServerQueryTimeout(timeout) {
100104

101105
export function setCurrentServerSlashApiKey(slashApiKey) {
102106
clientStubOptions.headers["X-Auth-Token"] = slashApiKey;
107+
clientStubOptions.headers["Authorization"] = authToken;
103108
}
104109

105110
export function setCurrentServerAuthToken(authToken) {
106111
clientStubOptions.headers["X-Dgraph-AuthToken"] = authToken;
107-
clientStubOptions.headers["Authorization"] = authToken;
108112
}
109113

110114
export const getDgraphClient = async () =>

0 commit comments

Comments
 (0)