Below is my Pre-Request Script,
pm.sendRequest({
url: âhttp://xyz:1234/someuri/uriâ,
method: âGETâ,
header: [âAccept: /â,âContent-Type: application/jsonâ],
body: {
mode: ârawâ,
raw: JSON.stringify({âqueryâ: âselect * from employeeâ})
}
}, (err, res) => {
if (err) {
console.log(err);
}
else {
var data = res.json();
console.log(âResponse:â,data);
}
});
The above script fails with 400 Bad Request with below error
-
status: 400
-
error: âBad Requestâ
-
message: âRequired request body is missing: public org.springframework.http.ResponseEntity<java.lang.Object> com.lsx.DbUtility.RestServiceHello.getOracleResult(java.util.Map<java.lang.String, java.lang.String>,com.lsx.DbUtility.Qbuilder) throws java.sql.SQLException,java.lang.ClassNotFoundExceptionâ
It looks like Postman is Pruning the Body for http Get call, how can we allow this in Pre-Request script.
Please note that Iâm able to successfully call via a Postman Request which seem to use below settings to disable the pruning body from get request,
âprotocolProfileBehaviorâ: {
âdisableBodyPruningâ: true
},
I would like to do the same in Pre-request script but i cannot find a working solution for it.
Please help.