فهرست منبع

originate test

Hal De 4 سال پیش
والد
کامیت
792b0ebbaf
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      app/app.py

+ 3 - 2
app/app.py

@@ -117,11 +117,12 @@ class AuthMiddleware:
       for device in app.cache['devices']:
         if ((header == bytes('{}_{}'.format(app.config['AUTH_HEADER'].lower(), device), 'utf-8')) and
             (value == bytes(app.cache['devices'][device], 'utf-8'))):
+          body = bytes('scope: {}'.format(pformat(getmembers(scope), indent=1)), 'utf-8')
           await send({'type': 'http.response.start',
                       'status': 200,
-                      'headers': [(b'content-length', b'500000')]})
+                      'headers': [(b'content-length', bytes(str(len(body))))]})
           await send({'type': 'http.response.body',
-                      'body': bytes('scope: {}'.format(pformat(getmembers(scope), indent=1)), 'utf-8'),
+                      'body': body,
                       'more_body': False})
 
           return await self.app(scope, receive, send)