mongodb-memory-server-core
Advanced tools
Comparing version 6.3.1 to 6.3.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [6.3.2](https://github.com/nodkz/mongodb-memory-server/compare/v6.3.1...v6.3.2) (2020-03-03) | ||
### Bug Fixes | ||
* **MongoBinaryDownload:** handle Status Codes other than 200 ([#273](https://github.com/nodkz/mongodb-memory-server/issues/273)) ([3d68233](https://github.com/nodkz/mongodb-memory-server/commit/3d68233)), closes [#226](https://github.com/nodkz/mongodb-memory-server/issues/226) | ||
## [6.3.1](https://github.com/nodkz/mongodb-memory-server/compare/v6.3.0...v6.3.1) (2020-02-28) | ||
@@ -8,0 +19,0 @@ |
@@ -17,2 +17,5 @@ import { DownloadProgressT } from '../types'; | ||
} | ||
/** | ||
* Download and extract the "mongod" binary | ||
*/ | ||
export default class MongoBinaryDownload { | ||
@@ -19,0 +22,0 @@ dlProgress: DownloadProgressT; |
@@ -63,2 +63,5 @@ "use strict"; | ||
var log = debug_1.default('MongoMS:MongoBinaryDownload'); | ||
/** | ||
* Download and extract the "mongod" binary | ||
*/ | ||
var MongoBinaryDownload = /** @class */ (function () { | ||
@@ -211,3 +214,3 @@ function MongoBinaryDownload(_a) { | ||
tempDownloadLocation = path_1.default.resolve(this.downloadDir, filename + ".downloading"); | ||
log("Downloading" + (proxy ? " via proxy " + proxy : '') + ":", downloadUrl); | ||
log("Downloading" + (proxy ? " via proxy " + proxy : '') + ": \"" + downloadUrl + "\""); | ||
return [4 /*yield*/, this.httpDownload(downloadOptions, downloadLocation, tempDownloadLocation)]; | ||
@@ -281,3 +284,17 @@ case 1: | ||
var fileStream = fs_1.default.createWriteStream(tempDownloadLocation); | ||
var req = https_1.default.get(httpOptions, function (response) { | ||
https_1.default | ||
.get(httpOptions, function (response) { | ||
if (response.statusCode != 200) { | ||
if (response.statusCode === 403) { | ||
reject(new Error("Status Code is 403 (MongoDB's 404)\n" + | ||
'This means that the requested version-platform combination dosnt exist')); | ||
return; | ||
} | ||
reject(new Error('Status Code isnt 200!')); | ||
return; | ||
} | ||
if (typeof response.headers['content-length'] != 'string') { | ||
reject(new Error('Response header "content-length" is empty!')); | ||
return; | ||
} | ||
_this.dlProgress.current = 0; | ||
@@ -302,3 +319,3 @@ _this.dlProgress.length = parseInt(response.headers['content-length'], 10); | ||
_a.sent(); | ||
log("renamed " + tempDownloadLocation + " to " + downloadLocation); | ||
log("moved " + tempDownloadLocation + " to " + downloadLocation); | ||
resolve(downloadLocation); | ||
@@ -312,7 +329,7 @@ return [2 /*return*/]; | ||
}); | ||
req.on('error', function (e) { | ||
// log it without having debug enabled | ||
console.error("Couldnt download " + httpOptions.path + "!", e.message); | ||
reject(e); | ||
}); | ||
}) | ||
.on('error', function (e) { | ||
// log it without having debug enabled | ||
console.error("Couldnt download " + httpOptions.path + "!", e.message); | ||
reject(e); | ||
}); | ||
@@ -319,0 +336,0 @@ })]; |
@@ -8,2 +8,5 @@ import { AnyOS, LinuxOS } from './getos'; | ||
} | ||
/** | ||
* Download URL generator | ||
*/ | ||
export default class MongoBinaryDownloadUrl { | ||
@@ -10,0 +13,0 @@ platform: string; |
@@ -47,2 +47,5 @@ "use strict"; | ||
var log = debug_1.default('MongoMS:MongoBinaryDownloadUrl'); | ||
/** | ||
* Download URL generator | ||
*/ | ||
var MongoBinaryDownloadUrl = /** @class */ (function () { | ||
@@ -49,0 +52,0 @@ function MongoBinaryDownloadUrl(_a) { |
{ | ||
"name": "mongodb-memory-server-core", | ||
"version": "6.3.1", | ||
"version": "6.3.2", | ||
"description": "MongoDB Server for testing (core package, without autodownload). The server will allow you to connect your favourite ODM or client library to the MongoDB Server and run parallel integration tests isolated from each other.", | ||
@@ -79,3 +79,3 @@ "main": "lib/index", | ||
}, | ||
"gitHead": "dde00c95b262dbae7b443cd60b95b7d78748b89e" | ||
"gitHead": "a498bef1ab18d6bc229c76551ebc7ce4289af1b9" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
334401
4852