[GH-ISSUE #5854] [bug]: When using scripts, may sometimes enter a letter that automatically formats and adds a space. #2297

Closed
opened 2026-03-16 23:53:06 +03:00 by kerem · 0 comments
Owner

Originally created by @zhaoqiang1024 on GitHub (Feb 10, 2026).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5854

Is there an existing issue for this?

  • I have searched existing issues and this bug hasn't been reported yet

Platform

Desktop App

Browser

Chrome

Operating System

macOS

Bug Description

Image As shown in the figure above, there is a variable named array. When 'ar' is entered in the for loop, a space is automatically appended. macOS:26.1 (25B78) script: var appKey = '111111'; var appSecret = "22222"; var nonce = "3333"; var path = "/text/testApi"; var timestamp = Date.now().toString(); var stringToSign = appKey + "-" + path + "-" + timestamp + "-" + nonce + "-" + appSecret;

var msg = new TextEncoder().encode(stringToSign);
var hash = await crypto.subtle.digest('SHA-256', msg).then(function (hash) {
return Array.from(new Uint8Array(hash)).map(b => ('00' + b.toString(16)).slice(-2)).join('').toUpperCase();
});

pw.env.set("X-Api-Key", appKey);
pw.env.set("X-Api-Version", "1");
pw.env.set("X-Api-Signature", hash);
pw.env.set("X-Api-Timestamp", timestamp);
pw.env.set("X-Api-Nonce", nonce);

var extraDataObj = {
"user": {
"userId": "101060"
}
};

var extraDataJson = JSON.stringify(extraDataObj);
var array = new TextEncoder().encode(extraDataJson);

var binaryStr = '';

// utf8Bytes.forEach(byte => {
// binaryStr += String.fromCharCode(byte);
// });
var blob = btoa(binaryStr);
pw.env.set("extraData", extraDataJson);
for (var i = 0 ; i < array.length; i++){
ar rr ay
}

Deployment Type

Hoppscotch Cloud

Version

Version 26.1.0 (26.1.0)

Originally created by @zhaoqiang1024 on GitHub (Feb 10, 2026). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5854 ### Is there an existing issue for this? - [x] I have searched existing issues and this bug hasn't been reported yet ### Platform Desktop App ### Browser Chrome ### Operating System macOS ### Bug Description <img width="1106" height="385" alt="Image" src="https://github.com/user-attachments/assets/4d2a79e3-f5a3-4d81-993f-9f60c66b2d64" /> As shown in the figure above, there is a variable named array. When 'ar' is entered in the for loop, a space is automatically appended. macOS:26.1 (25B78) script: var appKey = '111111'; var appSecret = "22222"; var nonce = "3333"; var path = "/text/testApi"; var timestamp = Date.now().toString(); var stringToSign = appKey + "-" + path + "-" + timestamp + "-" + nonce + "-" + appSecret; var msg = new TextEncoder().encode(stringToSign); var hash = await crypto.subtle.digest('SHA-256', msg).then(function (hash) { return Array.from(new Uint8Array(hash)).map(b => ('00' + b.toString(16)).slice(-2)).join('').toUpperCase(); }); pw.env.set("X-Api-Key", appKey); pw.env.set("X-Api-Version", "1"); pw.env.set("X-Api-Signature", hash); pw.env.set("X-Api-Timestamp", timestamp); pw.env.set("X-Api-Nonce", nonce); var extraDataObj = { "user": { "userId": "101060" } }; var extraDataJson = JSON.stringify(extraDataObj); var array = new TextEncoder().encode(extraDataJson); var binaryStr = ''; // utf8Bytes.forEach(byte => { // binaryStr += String.fromCharCode(byte); // }); var blob = btoa(binaryStr); pw.env.set("extraData", extraDataJson); for (var i = 0 ; i < array.length; i++){ ar rr ay } ### Deployment Type Hoppscotch Cloud ### Version Version 26.1.0 (26.1.0)
kerem 2026-03-16 23:53:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#2297
No description provided.