After Mockjs intercepts the post request, can the parameter be directly set to json format?

attempts to use Mockjs to intercept post requests. The obtained option.body appears to be a string,

for example:

{ 
  url: "http://test.cn/entity/save", 
  type: "POST", 
  body: "name=abc&type=1"
}

is there any setting that can be directly obtained into json, such as the following

?
{ 
  url: "http://test.cn/entity/save", 
  type: "POST", 
  body: {
    name: "abc",
    type: 1
  }
}
Mar.30,2021

Sorry, it's solved. Just use the qs library

.
qs.parse(string, [options]);
  • How does easymock judge?

    problem description there is no way to dynamically change the value of success in the returned data the environmental background of the problems and what methods you have tried I use ajax as a login interface. Because there is no background, I use...

    Mar.30,2021
  • Mockjs wraps the data I want with another layer.

    for example, the return I want is { a: 1 } the data returned after using mockjs is { config: ..., data: { a: 1 }, headers: ..., status: ... } what I can make mockjs direct against me is the format I configured, not another layer of d...

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bfcc-2bae3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bfcc-2bae3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?