analyze now works for all roles from the console, closes #1457 (#1459)

This commit is contained in:
Karthik Venkateswaran 2019-01-24 23:10:11 +05:30 committed by Vamshi Surabhi
parent 5b66ca8c42
commit 8342a962d5

View File

@ -242,6 +242,18 @@ const analyzeFetcher = (url, headers, analyzeApiChange) => {
'x-hasura-role': 'admin',
};
}
// Check if x-hasura-role is available in some form in the headers
const totalHeaders = Object.keys(reqHeaders);
totalHeaders.forEach((t) => {
// If header has x-hasura-*
const lHead = t.toLowerCase();
if (lHead.slice(0, 'x-hasura-'.length) === 'x-hasura-') {
user[lHead] = reqHeaders[t];
delete reqHeaders[t];
}
});
editedQuery.user = user;
return fetch(`${url}/explain`, {
method: 'post',