How to input array in body of POST , with RestFixture

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to input array in body of POST , with RestFixture

FitNesse mailing list
Hallo guys,
 

 sorry, i am a newbie of restFixture. I want to ask about how to input array 2 dimensional in body of POST .
 I already spend many time to looking for that.
 

 Expected input:
 item[0][description]
 item[0][qty]
 item[0][price]
 

 | setBody | <resource> <Items> <entry index="0"> <description> blabla</description> <quantity>1</quantity> <unitPrice>100000000 </unitPrice></entry> <entry index="1"> <description> blabla</description> <quantity>1</quantity> <unitPrice>100000000 </unitPrice></entry> </Items><resource> |
 

 but the output is not my expectation
 

 i don't have idea. Anyone can help me?
Reply | Threaded
Open this post in threaded view
|

Re: How to input array in body of POST , with RestFixture

FitNesse mailing list
Hi - I am not clear on what you are asking. Do you need to POST some xml content? or JSON?
 

 | setBody |  .... |
 

 is the way you set the content for the next HTTP operation. Whatever you write in the value cell of the setBody depends on what the server API expects.
 Most likely you'll have to set the appropriate headers via | setHeaders | .... |
 

 You may want to post here the fixture you're implementing and if possible what error you get from the server.
 

 fabrizio
Reply | Threaded
Open this post in threaded view
|

Re: How to input array in body of POST , with RestFixture

FitNesse mailing list
Hai fab, Sorry for the late reply.
 

 i want to write it using xml content.
 

 I already found the syntax.
 

 | !-Table:smartrics.rest.fitnesse.fixture.RestFixture | url |
 | setBody | <resource<item index = "0"> <description> blabla 1</description> <quantity>1</quantity> <unitPrice>100000000 </unitPrice> </item ><resource> |

 | POST | .. |
 

 

 Thanks for the response Fab