fix xml parser
This commit is contained in:
parent
b4c44e7622
commit
8412cbc572
16
src/index.js
16
src/index.js
@ -36,7 +36,7 @@ export const main = async () => {
|
|||||||
origin: true,
|
origin: true,
|
||||||
credentials: true,
|
credentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
server.register(oauth, {
|
server.register(oauth, {
|
||||||
name: 'googleOAuth2',
|
name: 'googleOAuth2',
|
||||||
scope: ['https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/youtube.force-ssl', "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"],
|
scope: ['https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/youtube.force-ssl', "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"],
|
||||||
@ -58,15 +58,11 @@ export const main = async () => {
|
|||||||
callbackUri: `${env.PUBLIC_API_URL}/auth/google/callback`
|
callbackUri: `${env.PUBLIC_API_URL}/auth/google/callback`
|
||||||
});
|
});
|
||||||
|
|
||||||
server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, async (request, payload, done) => {
|
server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, function (request, payload, done) {
|
||||||
try {
|
xml2js.parseString(payload, function (err, body) {
|
||||||
let parsed = await xml2js.parseStringPromise(payload);
|
done(err, body)
|
||||||
done(null, parsed)
|
})
|
||||||
} catch(e) {
|
})
|
||||||
console.log(e);
|
|
||||||
done(e, undefined)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
server.register(channelRoutes, {
|
server.register(channelRoutes, {
|
||||||
|
Loading…
Reference in New Issue
Block a user