Merge pull request #2478 from influxdata/bugfix/logging-cookies

Fix headers sent to Kapacitor proxy endpoint by clientside fetch
pull/2450/head^2
Nathan Haugo 2017-12-04 15:56:13 -08:00 committed by GitHub
commit 58a8c69ec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -101,10 +101,16 @@ export const updateTask = async (
}
}
const kapacitorLogHeaders = {
'Content-Type': 'application/json',
Accept: 'application/json',
}
export const getLogStream = kapacitor =>
fetch(`${kapacitor.links.proxy}?path=/kapacitor/v1preview/logs`, {
method: 'GET',
headers: {'Content-Type': 'application/json'},
headers: kapacitorLogHeaders,
credentials: 'include',
})
export const getLogStreamByRuleID = (kapacitor, ruleID) =>
@ -112,7 +118,8 @@ export const getLogStreamByRuleID = (kapacitor, ruleID) =>
`${kapacitor.links.proxy}?path=/kapacitor/v1preview/logs?task=${ruleID}`,
{
method: 'GET',
headers: {'Content-Type': 'application/json'},
headers: kapacitorLogHeaders,
credentials: 'include',
}
)
@ -121,6 +128,8 @@ export const pingKapacitorVersion = async kapacitor => {
const result = await AJAX({
method: 'GET',
url: `${kapacitor.links.proxy}?path=/kapacitor/v1preview/ping`,
headers: kapacitorLogHeaders,
credentials: 'include',
})
const kapVersion = result.headers['x-kapacitor-version']
return kapVersion === '' ? null : kapVersion