File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,9 @@ test.describe("oc-client : getData", () => {
131131 if ( bodyData instanceof URLSearchParams ) {
132132 // Handle URL-encoded body
133133 const componentsParam = JSON . parse ( bodyData . get ( "components" ) ) ;
134- expect ( componentsParam [ 0 ] . name ) . toEqual ( "myComponent" ) ;
135- expect ( componentsParam [ 0 ] . version ) . toEqual ( "6.6.6" ) ;
136- expect ( componentsParam [ 0 ] . parameters . name ) . toEqual ( "evil" ) ;
134+ expect ( bodyData . get ( "components [0][ name]" ) ) . toEqual ( "myComponent" ) ;
135+ expect ( bodyData . get ( "components [0][ version]" ) ) . toEqual ( "6.6.6" ) ;
136+ expect ( bodyData . get ( "components [0][ parameters][ name]" ) ) . toEqual ( "evil" ) ;
137137 } else {
138138 // Handle JSON body
139139 expect ( bodyData . components [ 0 ] . name ) . toEqual ( "myComponent" ) ;
@@ -336,7 +336,10 @@ test.describe("oc-client : getData", () => {
336336 } else {
337337 // Create a simple parser for url-encoded data
338338 const params = new URLSearchParams ( options . body ) ;
339- bodyData = { components : JSON . parse ( params . get ( "components" ) ) } ;
339+ const name = params . get ( "components[0][parameters][name]" ) ;
340+ const test = params . get ( "components[0][parameters][test]" ) ;
341+
342+ bodyData = { components : [ { parameters : { name, test } } ] } ;
340343 }
341344
342345 requestData = {
You can’t perform that action at this time.
0 commit comments