Browse Source

companion: send content-length for oneDrive domain verification

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

+ 7 - 9
packages/@uppy/companion/src/standalone/index.js

@@ -160,18 +160,16 @@ 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) => {
+    const content = JSON.stringify({
+      associatedApplications: [
+        { applicationId: process.env.COMPANION_ONEDRIVE_KEY }
+      ]
+    })
+    res.header('Content-Length', `${content.length}`)
     // 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: [
-          {
-            applicationId: process.env.COMPANION_ONEDRIVE_KEY
-          }
-        ]
-      })
-    )
+    res.end(content)
   })
 }