Socket
Socket
Sign inDemoInstall

nano

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nano - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

tests/session/create.js

2

cfg/tests.js

@@ -1,1 +0,1 @@

module.exports = exports = cfg = { url: 'http://testnano.iriscouch.com' };
module.exports = exports = cfg = { url: 'http://nodejsbug.iriscouch.com' };

@@ -123,2 +123,5 @@ /* minimal couch in node

}
if(cfg.cookie){
req.headers["cookie"] = cfg.cookie;
}
if(!_.isEmpty(params)) {

@@ -146,2 +149,5 @@ ['startkey', 'endkey', 'key'].forEach(function (key) {

if (status_code >= 200 && status_code < 300) {
if (rh['set-cookie']){
cfg.cookie = rh['set-cookie']; //get auth cookie
}
callback(null,parsed,rh);

@@ -288,3 +294,33 @@ }

}
/****************************************************************************
* session *
****************************************************************************/
/*
* creates session
*
* e.g. nano.session.create(user, password)
*
* @param {user:string} user name
* @param {pass:string} password
*
* @see relax
*/
function create_session(user, password, callback) {
var body = new Buffer("name=" + user + "&" + "password=" + password);
return relax({db: "_session", body:body, method: "POST", content_type: "application/x-www-form-urlencodeddata"}, callback);
}
/*
* deletes session
*
* e.g. nano.session.delete()
*
* @see relax
*/
function delete_session(callback) {
cfg.cookie = null; //make sure cookie gets destroyed also if error
return relax({db: "_session", method: "DELETE"}, callback);
}
/****************************************************************************

@@ -514,2 +550,5 @@ * doc *

}
, session: { create: create_session
, delete: delete_session
}
, use: document_module

@@ -524,3 +563,3 @@ , scope: document_module // alias

// does the user want a database, or nano?
if(!_.isEmpty(path.pathname.split('/')[1])) {
if(path.pathname && !_.isEmpty(path.pathname.split('/')[1])) {
db = path.pathname.split('/')[1];

@@ -527,0 +566,0 @@ cfg.url = path.protocol + '//' + path.host; // reset url

@@ -5,3 +5,3 @@ { "name" : "nano"

, "repository" : "git://github.com/dscape/nano"
, "version" : "0.9.3"
, "version" : "0.9.4"
, "author" : "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)"

@@ -11,6 +11,8 @@ , "contributors" :

, "Derek Perez <derek@derekperez.com> (http://blog.derekperez.com)"
, "Patrick Heneise (http://patrickheneise.me)"
, "Artur Konarski (http://tarantoga.com)"
]
, "keywords" : ["couchdb", "data", "request", "json", "nosql", "micro", "nano"]
, "dependencies" : {"request": "~2.1.1", "underscore": "~1.1.7"}
, "devDependencies" : { "async": "~0.1.9", "ensure": "0.4.x" }
, "dependencies" : {"request": "2.2.0", "underscore": "~1.1.7"}
, "devDependencies" : { "async": "~0.1.9", "ensure": "0.4.6" }
, "scripts" : { "test": "./node_modules/ensure/bin/tap.js tests/*/*.js" }

@@ -17,0 +19,0 @@ , "main" : "./nano.js"

@@ -176,5 +176,16 @@ # nano

*useful tip*: to run a single test and get verbose output you can do
# tests
to run (and configure) the test suite simply:
``` sh
cd nano
vi cfg/tests.js
npm install # should install ensure and async, if it doesnt install manually
npm test
```
after adding a new test you can run it individually (with verbose output) using:
``` sh
NANO_ENV=testing node tests/doc/list.js list_doc_params

@@ -185,11 +196,2 @@ ```

# tests
1. install the packages referred as dev dependencies in `package.json`
2. browse to `test/` and `./run`.
always make sure all the tests pass before sending in your pull request!
we will tell santa
# meta

@@ -196,0 +198,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc