gnh1201 / welsonjs

WelsonJS - Build a Windows app on the Windows built-in JavaScript engine
https://catswords.social/@catswords_oss
GNU General Public License v3.0
143 stars 12 forks source link

[lib/http] `this.evaluate()` (String Formatter) not properly work with JSON data #122

Closed gnh1201 closed 1 month ago

gnh1201 commented 1 month ago

Summary

In the lib/http module, this.evaluate() is a method that acts as a String Formatter. It allows you to format external variables into a string using curly braces. For example, var1={var1}; var2={var2}

When using strings instead of JSON data, which is not the recommended method, there is an issue where the curly braces are removed.

Recommended example

client.setRequestBody({a: 1, b: "hello world", c: 3}).setDataType("json");

Example used in an user environment

client.setRequestBody("{a: 1, b: \"hello world\", c: 3}");   // without setDataType()
gnh1201 commented 1 month ago

https://github.com/gnh1201/welsonjs/commit/8b5abfe0220b2e7e746c094502822e6c811cefe4

gnh1201 commented 1 month ago

Fixed

gnh1201 commented 1 month ago

Reopened