Support capturing HTTP Authentication - fixes #11
This commit is contained in:
parent
5e7dedf6d5
commit
358efd59fd
@ -72,6 +72,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
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