Skip to content

Loading…

Basic Auth #26

Merged
merged 1 commit into from

3 participants

@Stanley

Example usage:

suite.use('localhost', 8080, {auth: 'user:password'})
@Marak Marak merged commit 4e14621 into vowsjs:master
@sebs

works like a charm, but could use a hint in the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2012
  1. @Stanley

    Add basicAuth support

    Stanley committed
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/api-easy.js
View
2 lib/api-easy.js
@@ -94,6 +94,7 @@ exports.describe = function (text) {
this.host = host || 'localhost';
this.port = port || 80;
this.secure = options.secure || false;
+ this.auth = options.auth;
//
// **TODO _(indexzero)_:** Setup `this.options` here (i.e. options for the SUITE, not the REQUEST)
@@ -431,6 +432,7 @@ exports.describe = function (text) {
// using the information provided to this instance and `_request()`.
//
outgoing.uri = this.secure ? 'https://' : 'http://';
+ outgoing.uri += this.auth ? this.auth + '@' : '';
outgoing.uri += this.host + port + fullUri;
outgoing.method = method;
Something went wrong with that request. Please try again.