Closed ilaktasic closed 5 years ago
I figured it out, haven't noticed that body must be base64 encoded. This is how it looks like now
jq -ncM '1 | while(true; .+1) | {method:"POST", url:"http://:8080/v1", body:{fileUrl:. |tonumber|(.%5)|tostring|(.+"id"), thumbnailUrl:.|tostring|(.+"url")} | @base64, "header":{"Content-Type":["application/json;charset=UTF-8"]}}'| vegeta attack -rate=50/s -lazy -format=json -duration=3s |vegeta encode| tee results.bin | vegeta report
Question
Can you provide example of generating json targets using jq or other generator, I can't find out in which format vegeta expects body field to be. Example what I'm tying to do:
jq -ncM '1 | while(true; .+1) | {method:"POST", url:"http://:8080/v1", body:{fileId:. |tonumber|(.%5)|tostring|(.+"id"), thumbnailId:.|tostring|(.+"id")}, "header":{"Content-Type":"application/json;charset=UTF-8"}}'| vegeta attack -rate=50/s -lazy -format=json -duration=30s | tee results.bin | vegeta report
basically I'm creating new id for every thumbnailId and fileId is looping between 1 and 5
EDIT: forgot to mention, example above returns
parse error: expected string near offset 49 of 'body'