Skip to content

Commit 2c6ea8c

Browse files
committed
chore: drop Authorization header for noAuth
1 parent 67008db commit 2c6ea8c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/gqltest.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function deployEndpoint(endpoint, dirname) {
4646
// The test will fail if the request does not
4747
// have status 200 or has any GraphQL errors.
4848
function runGqlOk(authType, endpoint, query, variables, operationName) {
49+
let authValue;
4950
switch (authType) {
5051
case authTypes.adminKey:
5152
authValue = adminKey;
@@ -59,12 +60,18 @@ function runGqlOk(authType, endpoint, query, variables, operationName) {
5960
default:
6061
authValue = "";
6162
}
63+
64+
let headers = {
65+
"Content-Type": "application/json",
66+
};
67+
68+
if (authValue) {
69+
headers.Authorization = authValue;
70+
}
71+
6272
return fetch(endpoint, {
6373
method: "POST",
64-
headers: {
65-
"Content-Type": "application/json",
66-
Authorization: authValue,
67-
},
74+
headers: headers,
6875
body: JSON.stringify({
6976
query: query,
7077
variables: variables,

0 commit comments

Comments
 (0)