@@ -31,12 +31,13 @@ function parseUrlEncoded (body, indent, trim) {
3131 * @param {Object } body Raw body data
3232 * @param {Boolean } trim indicates whether to trim string or not
3333 * @param {String } contentType the content-type of request body
34+ * @param {Integer } indentCount the number of space to use
3435 */
35- function parseRawBody ( body , trim , contentType ) {
36+ function parseRawBody ( body , trim , contentType , indentCount ) {
3637 if ( contentType && ( contentType === 'application/json' || contentType . match ( / \+ j s o n $ / ) ) ) {
3738 try {
3839 let jsonBody = JSON . parse ( body ) ;
39- return `request.body = json.encode(${ JSON . stringify ( jsonBody , null , 4 ) } );` ;
40+ return `request.body = json.encode(${ JSON . stringify ( jsonBody , null , indentCount ) } );` ;
4041
4142 }
4243 catch ( error ) {
@@ -129,7 +130,7 @@ function parseBody (body, indent, trim, contentType) {
129130 case 'urlencoded' :
130131 return parseUrlEncoded ( body . urlencoded , indent , trim ) ;
131132 case 'raw' :
132- return parseRawBody ( body . raw , trim , contentType ) ;
133+ return parseRawBody ( body . raw , trim , contentType , indent . length ) ;
133134 case 'formdata' :
134135 return parseFormData ( body . formdata , indent , trim ) ;
135136 case 'graphql' :
0 commit comments