page-spy-web
page-spy-web copied to clipboard
content-type 为 application/x-www-form-urlencoded,展示入参的时候格式化一下数据
Description
目前展示的格式是:
期望展示成:
Suggested solution
将a=1&b=2的字符串转成 json
function queryStringToJSON(queryString) {
// Split the query string into key-value pairs
let pairs = queryString.split('&');
let result = {};
// Iterate over the pairs
pairs.forEach(pair => {
let [key, value] = pair.split('=');
// Decode both key and value to handle URL encoding
key = decodeURIComponent(key);
value = decodeURIComponent(value || '');
// Add key-value pair to result object
result[key] = value;
});
return result;
}
Alternative
No response
Additional context
No response
Validations
- [X] Read the FAQ.
- [X] Read the Contributing Guidelines.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.