You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:29:45 UTC

[GitHub] [cordova-serve] raphinesse commented on a change in pull request #45: Update main.js

raphinesse commented on a change in pull request #45:
URL: https://github.com/apache/cordova-serve/pull/45#discussion_r729918273



##########
File path: src/main.js
##########
@@ -33,7 +33,8 @@ function CordovaServe () {
         res.on('finish', function () {
             const color = this.statusCode === '404' ? chalk.red : chalk.green;
             let msg = `${color(this.statusCode)} ${this.req.originalUrl}`;
-            const encoding = this._headers && this._headers['content-encoding'];
+            const headers = this.getHeaders();
+            const encoding = headers && headers['content-encoding'];

Review comment:
       Why not use [outgoingMessage.getHeader](https://nodejs.org/api/http.html#http_outgoingmessage_getheader_name)? That should work, AFAICT...
   ```suggestion
               const encoding = this.getHeader('content-encoding');
   ```

##########
File path: src/main.js
##########
@@ -33,7 +33,8 @@ function CordovaServe () {
         res.on('finish', function () {
             const color = this.statusCode === '404' ? chalk.red : chalk.green;
             let msg = `${color(this.statusCode)} ${this.req.originalUrl}`;
-            const encoding = this._headers && this._headers['content-encoding'];
+            const headers = this.getHeaders();
+            const encoding = headers && headers['content-encoding'];

Review comment:
       Just verified that this works




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org