How to use https - 10 common examples

To help you get started, we’ve selected a few https examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github itachiRedhair / alexa-skill-local / endpointController.js View on Github external
return new Promise((resolve, reject) => {
        const req = https.request(options, function (res) {
            res.setEncoding('utf8');
            res.on('data', function (body) {
                resolve({ statusCode: res.statusCode })
            });
        });
        req.on('error', function (e) {
            // throw new Error(`Error updating Alexa Skill Endpoint`);
            reject(e);
        });
        // write data to request body
        req.write(JSON.stringify(body));
        req.end();
    })
}
github ExtraBB / open-psd2 / src / ing.ts View on Github external
constructor(useSandbox: boolean, _signingKey: string, _signingPassphrase: string, _tlsCertificate: string, _tlsKey: string, _clientId: string) {
        this.SANDBOX = useSandbox;
        this.apiBasePath = useSandbox ? "https://api.sandbox.ing.com" : "https://api.ing.com";
        this.signingKey = _signingKey;
        this.signingPassphrase = _signingPassphrase;
        this.tlsCert = _tlsCertificate;
        this.tlsKey = _tlsKey;
        this.clientId = _clientId;

        // Create HTTPS agent
        this.agent = new https.Agent({
            rejectUnauthorized: false,
            cert: this.tlsCert,
            key: this.tlsKey
        });
    }
github molnarg / node-http2 / test / http.js View on Github external
server.listen(1236, function() {
          var options = url.parse('https://localhost:1236' + path);
          options.agent = new https.Agent(agentOptions);
          https.get(options, function(response) {
            response.on('data', function(data) {
              expect(data.toString()).to.equal(message);
              done();
            });
          });
        });
      });
github DanielSchaffer / webpack-babel-multi-target-plugin / examples / _util / browserstack-reporter.ts View on Github external
return new Promise((resolve, reject) => {
      const req = request(options, (res) => {
        res.on('error', reject)
        res.on('data', (buf) => console.log('marked', res.statusCode, buf.toString()))
        res.on('end', resolve)
      })

      req.on('error', err => reject(err))
      console.log('marking', data)
      req.write(data)
      req.end()
    })
  }
github DanielSchaffer / webpack-babel-multi-target-plugin / examples / angular / protractor.conf.js View on Github external
return new Promise((resolve, reject) => {
      const req = https.request(options, (res) => {
        res.on('error', reject)
        res.on('data', (buf) => console.log('marked', res.statusCode, buf.toString()))
        res.on('end', resolve)
      })

      req.on('error', err => reject(err))
      console.log('marking', data)
      req.write(data)
      req.end()
    })
  }
github andrewrk / groovebasin / lib / groovebasin.js View on Github external
pend.wait(function() {
        self.httpServer = https.createServer(options, self.app);
        cb();
      });
    }
github sealtalk / sealtalk-server / src / util / admin-report.js View on Github external
return new Promise((resolve, reject) => {
    var content = options.content;

    var req = https.request(options, function (res) {
      res.setEncoding('utf8');
      res.on('data', function (chunk) {
        resolve(chunk);
      });
    });
    req.on('error', function (e) {
      reject(e);
    });

    req.write(content);
    req.end();
  });
};
github cesanta / mongoose-os / fw / examples / helpers / cloudformation-helpers / aws / cognito.js View on Github external
return new Promise((resolve, reject) => {
      const request = https
        .request(options, resolve);

      request.on('error', error => reject(`send(..) failed executing https.request(..): ${error}`));
      request.write(responseBody);
      request.end();
    })
    .then(() => callback(responseStatus === FAILED ? responseStatus : null, responseData))
github andreas-marschke / boomerang-express / app.js View on Github external
function httpsListener(listener) {
  var server = https.createServer({
    key: fs.readFileSync(path.resolve(listener.key)),
    cert: fs.readFileSync(path.resolve(listener.cert))
  }, app);

  server.listen(listener.port, listener.listen, postStartup);
}
github jolira / site-manager / lib / launcher.js View on Github external
return loadKeyCert(sslKey, sslCert, function (err, credentials) {
                    if (err) {
                        return done(err);
                    }

                    result.sslPort = sslPort;
                    result.httpsServer = https.createServer(credentials, result.app);
                    result.httpsServer.on("listening", done);
                    result.httpsServer.on("error", function (err) {
                        return logger.error("https server error", err);
                    });
                    result.httpsServer.listen(sslPort);

                    return done();
                });
            });

https

https mediation

ISC
Latest version published 9 years ago

Package Health Score

59 / 100
Full package analysis