Comparing version 2.1.0 to 2.1.1
# CHANGELOG | ||
## v2.1.1 - 2022-10-28 | ||
### Fixes | ||
* :bug: fix for sending base64 documents. | ||
## v2.1.0 - 2022-10-19 | ||
@@ -4,0 +8,0 @@ ### Changes |
{ | ||
"name": "mindee", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Mindee Client Library for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -54,4 +54,2 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
const form = new form_data_1.default(); | ||
let body; | ||
let headers = { | ||
@@ -62,2 +60,7 @@ "User-Agent": USER_AGENT, | ||
const uri = new url_1.URL(`${this.urlRoot}/predict`); | ||
if (cropper) { | ||
uri.searchParams.append("cropper", "true"); | ||
} | ||
logger_1.logger.debug(`Prediction request: ${uri}`); | ||
const form = new form_data_1.default(); | ||
const fileParams = { filename: input.filename }; | ||
@@ -68,5 +71,2 @@ form.append("document", input.fileObject, fileParams); | ||
} | ||
if (cropper) { | ||
uri.searchParams.append("cropper", "true"); | ||
} | ||
headers = { ...headers, ...form.getHeaders() }; | ||
@@ -79,3 +79,2 @@ const options = { | ||
}; | ||
logger_1.logger.debug(`Prediction request: ${uri}`); | ||
const req = https.request(options, function (res) { | ||
@@ -100,12 +99,6 @@ // when the encoding is set, data chunks will be strings | ||
}); | ||
form.pipe(req); | ||
req.on("error", (err) => { | ||
reject(err); | ||
}); | ||
if (["path", "stream"].includes(input.inputType)) { | ||
form.pipe(req); | ||
} | ||
if (input.inputType === "base64") { | ||
req.write(body); | ||
req.end(); | ||
} | ||
}); | ||
@@ -112,0 +105,0 @@ } |
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
142147
3409