aotrautils-srv 0.0.306 → 0.0.308

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1_29072022-2359 (03/12/2022-16:08:46)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (03/12/2022-16:54:44)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4827,7 +4827,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4827
4827
 
4828
4828
 
4829
4829
 
4830
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (03/12/2022-16:08:46)»*/
4830
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (03/12/2022-16:54:44)»*/
4831
4831
  /*-----------------------------------------------------------------------------*/
4832
4832
 
4833
4833
 
@@ -5874,6 +5874,12 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
5874
5874
 
5875
5875
  let contentType="text/html";
5876
5876
 
5877
+ const headers={ "Content-Type": contentType };
5878
+
5879
+ // To remove the CORS error message (cf. https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9)
5880
+ if(ADD_CORS_HEADER) headers["Access-Control-Allow-Origin"]="*";
5881
+
5882
+
5877
5883
  fs.readFile(filePath, function(error, fileContent){
5878
5884
  if(error){
5879
5885
  if(error.code=="ENOENT"){
@@ -5881,7 +5887,7 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
5881
5887
  console.log("ERROR 404 file not found :"+filePath);
5882
5888
 
5883
5889
  fs.readFile("./404.html", function(error, fileContent){
5884
- response.writeHead(200, { "Content-Type": contentType });
5890
+ response.writeHead(200, headers);
5885
5891
  response.end(fileContent, "utf-8");
5886
5892
  });
5887
5893
 
@@ -5901,11 +5907,6 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
5901
5907
  // TRACE
5902
5908
  console.log("INFO 200 OK :"+filePath);
5903
5909
 
5904
- const headers={ "Content-Type": contentType };
5905
-
5906
- // To remove the CORS error message (cf. https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9)
5907
- if(ADD_CORS_HEADER) headers["Access-Control-Allow-Origin"]="*";
5908
-
5909
5910
 
5910
5911
  response.writeHead(200, headers);
5911
5912
  response.end(fileContent, "utf-8");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.306",
3
+ "version": "0.0.308",
4
4
  "main": "aotrautils-srv.build.js",
5
5
  "description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",