From e284ce294367d884a7f64e21b067821aecb2fad7 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Tue, 2 Aug 2022 09:11:31 +0200 Subject: [PATCH] fix: header name and remove clg --- src/index.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index 45aa453..c6a9ac9 100644 --- a/src/index.js +++ b/src/index.js @@ -186,14 +186,14 @@ async function gatherData(baseUrl, apiAuthKey, loginUtilisateur, pointId) { */ async function getDataStartDate(url, apiAuthKey, userLogin, pointId) { log('info', 'Fetching data start date') - const sampleHeaders = { + const sgeHeaders = { 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, } const { response } = await soapRequest({ url: url, - headers: sampleHeaders, + headers: sgeHeaders, xml: consulterDonneesTechniquesContractuelles(pointId, userLogin), }).catch(err => { log('error', 'technicalDataResponse') @@ -221,7 +221,7 @@ async function getDataStartDate(url, apiAuthKey, userLogin, pointId) { */ async function getData(url, apiAuthKey, userLogin, pointId) { log('info', 'Fetching data') - const sampleHeaders = { + const sgeHeaders = { 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, } @@ -230,7 +230,7 @@ async function getData(url, apiAuthKey, userLogin, pointId) { const { response } = await soapRequest({ url: url, - headers: sampleHeaders, + headers: sgeHeaders, xml: consultationMesuresDetaillees( pointId, userLogin, @@ -265,7 +265,7 @@ async function getData(url, apiAuthKey, userLogin, pointId) { */ async function getMaxPowerData(url, apiAuthKey, userLogin, pointId) { log('info', 'Fetching Max Power data') - const sampleHeaders = { + const sgeHeaders = { 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, } @@ -274,7 +274,7 @@ async function getMaxPowerData(url, apiAuthKey, userLogin, pointId) { const { response } = await soapRequest({ url: url, - headers: sampleHeaders, + headers: sgeHeaders, xml: consultationMesuresDetailleesMaxPower( pointId, userLogin, @@ -322,7 +322,7 @@ function setStartDate() { */ async function getDataHalfHour(url, apiAuthKey, userLogin, pointId) { log('info', 'Fetching data') - const sampleHeaders = { + const sgeHeaders = { 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, } @@ -342,7 +342,7 @@ async function getDataHalfHour(url, apiAuthKey, userLogin, pointId) { .format('YYYY-MM-DD') const { response } = await soapRequest({ url: url, - headers: sampleHeaders, + headers: sgeHeaders, xml: consultationMesuresDetaillees( pointId, userLogin, @@ -489,13 +489,13 @@ async function findUserPdl( inseeCode ) { log('info', 'Fetching user data') - const sampleHeaders = { + const sgeHeaders = { 'Content-Type': 'text/xml;charset=UTF-8', apikey: apiAuthKey, } const { response } = await soapRequest({ url: url, - headers: sampleHeaders, + headers: sgeHeaders, xml: rechercherPoint(appLogin, name, postalCode, inseeCode, addresse), }).catch(err => { log('error', 'rechercherPointResponse') @@ -511,6 +511,5 @@ async function findUserPdl( }) //TODO: handle errors - console.log(parsedReply) return parseUserPdl(parsedReply) } -- GitLab