aotrautils-srv 0.0.1412 → 0.0.1414

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 (19/04/2025-22:13:27)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (19/04/2025-22:21:24)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4894,7 +4894,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4894
4894
 
4895
4895
 
4896
4896
 
4897
- /*utils AI library associated with aotra version : «1_29072022-2359 (19/04/2025-22:13:27)»*/
4897
+ /*utils AI library associated with aotra version : «1_29072022-2359 (19/04/2025-22:21:24)»*/
4898
4898
  /*-----------------------------------------------------------------------------*/
4899
4899
 
4900
4900
 
@@ -5040,7 +5040,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5040
5040
 
5041
5041
 
5042
5042
 
5043
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (19/04/2025-22:13:27)»*/
5043
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (19/04/2025-22:21:24)»*/
5044
5044
  /*-----------------------------------------------------------------------------*/
5045
5045
 
5046
5046
 
@@ -6776,17 +6776,19 @@ getListManager=function(config){
6776
6776
  // USE THIS INSTEAD :
6777
6777
  performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyOrNamedArgs=null,isNodeContext=false,addCORSHeader=ADD_CORS_HEADER){
6778
6778
 
6779
- let requestBodyOrNamedArgsStr;
6780
- try{
6781
- requestBodyOrNamedArgsStr=stringifyObject(requestBodyOrNamedArgs);
6782
- }catch(parseErr){
6783
- requestBodyOrNamedArgsStr=""+requestBodyOrNamedArgs;
6779
+ let requestBodyOrNamedArgsStr=null;
6780
+ if(requestBodyOrNamedArgs){
6781
+ try{
6782
+ requestBodyOrNamedArgsStr=stringifyObject(requestBodyOrNamedArgs);
6783
+ }catch(parseErr){
6784
+ requestBodyOrNamedArgsStr=""+requestBodyOrNamedArgs;
6785
+ }
6784
6786
  }
6785
-
6786
6787
 
6787
6788
  if(contains(["POST","PUT"],httpMethod)){
6788
6789
  headers["Content-Type"]="application/json";
6789
- headers["Content-Length"]=Buffer.byteLength(requestBodyOrNamedArgsStr);
6790
+ if(requestBodyOrNamedArgsStr)
6791
+ headers["Content-Length"]=Buffer.byteLength(requestBodyOrNamedArgsStr);
6790
6792
 
6791
6793
  // 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)
6792
6794
  if(addCORSHeader) headers["Access-Control-Allow-Origin"]="*";
@@ -6935,9 +6937,8 @@ performHTTPRequest=function(completeURL,httpMethod="GET",headers={},requestBodyO
6935
6937
  // Not the same way to send parameters in POST http method :
6936
6938
  if(contains(["POST","PUT"],httpMethod)){
6937
6939
  // (We need to stringify parameters or else we'll have an error :)
6938
- if(!empty(requestBodyOrNamedArgs)){
6940
+ if(requestBodyOrNamedArgs)
6939
6941
  request.write(requestBodyOrNamedArgsStr);
6940
- }
6941
6942
  }
6942
6943
 
6943
6944
  // End the request
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1412",
3
+ "version": "0.0.1414",
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)",