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,
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
|
||||
server.register(oauth, {
|
||||
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"],
|
||||
@ -58,15 +58,11 @@ export const main = async () => {
|
||||
callbackUri: `${env.PUBLIC_API_URL}/auth/google/callback`
|
||||
});
|
||||
|
||||
server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, async (request, payload, done) => {
|
||||
try {
|
||||
let parsed = await xml2js.parseStringPromise(payload);
|
||||
done(null, parsed)
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
done(e, undefined)
|
||||
}
|
||||
})
|
||||
server.addContentTypeParser(['text/xml', 'application/xml', 'application/atom+xml'], { parseAs: 'string' }, function (request, payload, done) {
|
||||
xml2js.parseString(payload, function (err, body) {
|
||||
done(err, body)
|
||||
})
|
||||
})
|
||||
|
||||
// Routes
|
||||
server.register(channelRoutes, {
|
||||
|
Loading…
Reference in New Issue
Block a user