danwrong / restler

REST client library for node.js
MIT License
1.99k stars 391 forks source link

Secure protocol #177

Open rafacustodio opened 10 years ago

rafacustodio commented 10 years ago

I have to perform a request that uses SSLv3_method protocol, how can I change the secureProtocol in the request?

wallslide commented 9 years ago

I also had this problem. I've ended up using the request library, as it provides a place to enable this, but would really appreciate if restler added a way to do the same thing:

var request = require('request');
var opts = {
      url: 'https://example.com'
      , method: 'GET'
      , agentOptions: { secureProtocol: 'SSLv3_method' }
    };

request(opts, function(error, response, rawResponse){
      if(error) throw error;

      if(200 === response.statusCode){
        console.log("Headers", JSON.stringify(response.headers, null, 2));
        console.log("GOOD Response:\n");
        console.log(rawResponse);
      }else{
        console.log("Headers", JSON.stringify(response.headers, null, 2));
        console.log("Http Status: " + response.statusCode);
        console.log("Unexpected Response:\n");
        console.log(rawResponse);

      }
    });