Support capturing HTTP Authentication - fixes #11
This commit is contained in:
parent
044d02c547
commit
f75b12606a
@ -55,6 +55,8 @@ function FakeXMLHttpRequest() {
|
||||
open: function() {
|
||||
this.method = arguments[0];
|
||||
this.url = arguments[1];
|
||||
this.username = arguments[3];
|
||||
this.password = arguments[4];
|
||||
this.readyState = 1;
|
||||
},
|
||||
|
||||
|
@ -6,6 +6,7 @@ describe("FakeXMLHttpRequest", function() {
|
||||
it("should have an initial readyState of 0 (uninitialized)", function() {
|
||||
expect(xhr.readyState).toEqual(0);
|
||||
});
|
||||
|
||||
describe("when opened", function() {
|
||||
beforeEach(function() {
|
||||
xhr.open("GET", "http://example.com");
|
||||
@ -36,6 +37,20 @@ describe("FakeXMLHttpRequest", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("when opened with a username/password", function() {
|
||||
beforeEach(function() {
|
||||
xhr.open("GET", "http://example.com", true, "username", "password");
|
||||
});
|
||||
|
||||
it("should store the username", function() {
|
||||
expect(xhr.username).toEqual("username");
|
||||
});
|
||||
|
||||
it("should store the password", function() {
|
||||
expect(xhr.password).toEqual("password");
|
||||
});
|
||||
});
|
||||
|
||||
it("can be extended", function(){
|
||||
FakeXMLHttpRequest.prototype.foo = function(){
|
||||
return "foo";
|
||||
|
Loading…
Reference in New Issue
Block a user