Skip to content

Commit 23dd674

Browse files
Add middleware option to override credentials prop
1 parent 4108ef9 commit 23dd674

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/middleware/render-voyager-page.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ export interface MiddlewareOptions {
44
endpointUrl: string;
55
displayOptions?: object;
66
headersJS?: string;
7+
credentials?: string;
78
}
89

910
export default function renderVoyagerPage(options: MiddlewareOptions) {
10-
const { endpointUrl, displayOptions } = options;
11-
const headersJS = options.headersJS ? options.headersJS : '{}';
11+
const {
12+
endpointUrl,
13+
displayOptions,
14+
headersJS = '{}',
15+
credentials = 'include',
16+
} = options;
1217
return `
1318
<!DOCTYPE html>
1419
<html>
@@ -50,7 +55,7 @@ export default function renderVoyagerPage(options: MiddlewareOptions) {
5055
'Content-Type': 'application/json',
5156
}, ${headersJS}),
5257
body: JSON.stringify({query: introspectionQuery }),
53-
credentials: 'include',
58+
credentials: ${credentials},
5459
}).then(function (response) {
5560
return response.text();
5661
}).then(function (responseBody) {

0 commit comments

Comments
 (0)