req.protocol

The protocol used to send this request (req).

Usage

  1. req.protocol;

Example

  1. switch (req.protocol) {
  2. case 'http':
  3. // this is an HTTP request
  4. break;
  5. case 'https':
  6. // this is a secure HTTPS request
  7. break;
  8. }