angular-mock-record
Advanced tools
Comparing version 1.5.0 to 1.5.1
{ | ||
"name": "angular-mock-record", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "An angular / protractor framework that mocks and records requests. Requests can be manually mocked or recorded like VCR.", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
@@ -11,8 +11,10 @@ class Http { | ||
return new Promise((resolve, reject) => { | ||
let headers = this.setRequestHeaders(req.headers, _session_id); | ||
this.http.get( | ||
{ | ||
json: true, | ||
jar: true, | ||
url: this.config.domain + req.url, | ||
jar: true, | ||
headers: this.setRequestHeaders(req.headers, _session_id) | ||
headers: headers | ||
}, (error, response, body) => { | ||
@@ -62,6 +64,2 @@ | ||
this.config.request_headers.forEach(header => { | ||
out[header] = requestHeaders[header]; | ||
}); | ||
return out; | ||
@@ -68,0 +66,0 @@ } |
@@ -27,4 +27,4 @@ const Utilities = require('./utilities.js'); | ||
let recording = this.isRecordingOnTape(requestUrl, tape); | ||
let recordingWithDomain = recording ? recording.find(rec => rec.domain === this.config.domain) : null; | ||
let recordingWithContext = recording ? recording.find(rec => rec.context === this.config.context) : null; | ||
let recordingWithDomain = recording ? recording.find(rec => !!(rec.domain === this.config.domain && !rec.context)) : null; | ||
let recordingWithContext = recording ? recording.find(rec => !!(rec.context === this.config.context && rec.domain === this.config.domain)) : null; | ||
let shouldCheckContext = this.config.context; | ||
@@ -40,3 +40,3 @@ | ||
// If no context and domain, use the domain recording | ||
} else if (!shouldCheckContext && recordingWithDomain) { | ||
} else if (!shouldCheckContext && recordingWithDomain && !recordingWithDomain.context) { | ||
@@ -43,0 +43,0 @@ out = recordingWithDomain; |
19727
535