Description: port from request to axios
 node-request is deprecated. We port the test to node-axios.
Author: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Bug-Debian: https://bugs.debian.org/958680
Forwarded: not-needed
Last-Update: 2022-04-08
Index: node-opencv-7.0.0+git20200316.f0a03a4b/examples/face-proxy.js
===================================================================
--- node-opencv-7.0.0+git20200316.f0a03a4b.orig/examples/face-proxy.js
+++ node-opencv-7.0.0+git20200316.f0a03a4b/examples/face-proxy.js
@@ -1,8 +1,29 @@
 // Face recognition proxy
 var http = require('http'),
-    request = require('request'),
+    axios = require('axios'),
+    request = _axionRequest,
     cv = require('../lib/opencv');
 
+function _axionRequest(parameters, f) {
+    if (parameters.method == "GET") {
+	axios.get(parameters.uri, {timeout: parameters.timeout})
+	    .then(function (body) {
+		f(null, body.request.res, JSON.stringify(body.data));
+	    })
+	    .catch(function(err){
+		f(err, null, null);
+	    })
+    } else if (parameters.method == "POST") {
+	axios.post(parameters.uri, parameters.formData, {timeout: parameters.timeout})
+	    .then(function (body) {
+		f(null, body.request.res, JSON.stringify(body.data));
+	    })
+	    .catch(function(err){
+		f(err, null, null);
+	    })
+    }
+}
+
 var server = http.createServer(function(req, resp){
   var url = req.url.slice(1);
   request({uri:url, encoding:'binary'}, function(err, r, body){
Index: node-opencv-7.0.0+git20200316.f0a03a4b/package.json
===================================================================
--- node-opencv-7.0.0+git20200316.f0a03a4b.orig/package.json
+++ node-opencv-7.0.0+git20200316.f0a03a4b/package.json
@@ -9,7 +9,7 @@
   },
   "devDependencies": {
     "glob": "^5.0.3",
-    "request": "^2.88.2",
+    "axios": "^0.21.1",
     "tape": "^3.0.0"
   },
   "license": "MIT",
