Browse Source

companion: set required content type for oneDrive domain verification

ifedapoolarewaju 5 years ago
parent
commit
cace48ec72
1 changed files with 5 additions and 1 deletions
  1. 5 1
      packages/@uppy/companion/src/standalone/index.js

+ 5 - 1
packages/@uppy/companion/src/standalone/index.js

@@ -160,7 +160,10 @@ if (process.env.COMPANION_PATH) {
 // please do not set a value for COMPANION_ONEDRIVE_DOMAIN_VALIDATION
 if (process.env.COMPANION_ONEDRIVE_DOMAIN_VALIDATION === 'true' && process.env.COMPANION_ONEDRIVE_KEY) {
   app.get('/.well-known/microsoft-identity-association.json', (req, res) => {
-    res.json(
+    // use writeHead to prevent 'charset' from being appended
+    // https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-configure-publisher-domain#to-select-a-verified-domain
+    res.writeHead(200, { 'Content-Type': 'application/json' })
+    res.end(JSON.stringify(
       {
         associatedApplications: [
           {
@@ -168,6 +171,7 @@ if (process.env.COMPANION_ONEDRIVE_DOMAIN_VALIDATION === 'true' && process.env.C
           }
         ]
       })
+    )
   })
 }