Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part 2 Basic HTTP auth #73

Closed
thesailored opened this issue Feb 25, 2014 · 2 comments
Closed

Part 2 Basic HTTP auth #73

thesailored opened this issue Feb 25, 2014 · 2 comments

Comments

@thesailored
Copy link

vlucas, Could you please provide me with more info on how to get this to work? I'm struggling with how to tell it which url to use. A complete syntax that will run with jasmine-node command would be extremely helpful.

var user = 'myUserName'
var password = 'thePassword'
var urlHere = 'http://myserver.net:8080';

//HTTP Basic Auth
// @param string username
// @param string password
Frisby.prototype.auth = function(user, pass) {
authHash = new Buffer(user + ':' + pass).toString('base64');
this.addHeader('Authorization', 'Basic ' + authHash);
return this;
};

@vlucas
Copy link
Owner

vlucas commented Feb 25, 2014

It just adds a header to the current outgoing request. Use it like this:

frisby.create('Test HTTP Basic Auth')
  .get('http://myserver.net:8080')
  .auth('myUserName', 'thePassword')
.toss()

@thesailored
Copy link
Author

I answered my part 3 question. Thanks for the help!!!!

@vlucas vlucas closed this as completed Mar 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants