appcelerator/acs-node-sdk — pull request #16 by peri18 (2014-07-09 09:44:31+00:00)
Title: CLOUDSRV-3868 The rest API for acs-node is only support https now.

# Ticket:
https://jira.appcelerator.org/browse/CLOUDSRV-3868

# Description:
The rest API in our acs-node-sdk has been hardcoded to support https protocol, but doesn't support http protocol.
The error is show when we try to use the rest API with http protocol, use the app in examples/UserWithREST of this repo could reproduce this error.
Edit the controllers/user.js
```
var ACS = require('acs').ACS;
var logger = require('acs').logger;
var sdk = ACS.initACS('', '', 'localhost:8082');
......
```
When login/signup user, get the error message:
```
Invalid request sent.
```

This PR fix this issue to support both https/http protocols, when sdk.useSecure is set to true/false, sdk.useSecure is set to true as default.

# How to test for single image
We can use the app which in examples/UserWithREST in this repo.
1. Edit the controllers/user.js, use http protocol
```
var ACS = require('acs').ACS;
var logger = require('acs').logger;
var sdk = ACS.initACS('', '', 'localhost:8082');
sdk.useSecure=false;
......
```
2. Login user again, we should get the successful message
```
Welcome, ! logout
update your info
```
3. Edit the controllers/user.js again, use https protocol
```
var ACS = require('acs').ACS;
var logger = require('acs').logger;
var sdk = ACS.initACS('', '', 'localhost:8082');
......
```
4. Login user again, we should get the error message
```
Invalid request sent.
```