Get the POST body from Fiddler ready for curl
Fiddler Request seen with all sorts of new lines etc.
curl format wanted:
BASH - FIRST STEP ONLY - to adjust Fiddler text output file for use with curl:
cat fiddler_request.txt | tr '\r' '^' | tr '\n' '!' > temp_tr"
The main thing I've tackled here is just to get the BODY ready for a web request to use in LoadRunner, based on a Fiddler trace. In fact it was tricky and I ended up using the development team's actual curl code they had for their own testing. The above code is my first step. The second step could well be done in LoadRunner itself, just doing a text replacement for ^! to \r\n
IN FACT, I have tested the Vugen replacement successfully:
You can see here I have a VERY long input string, full off '^!' characters from the above BASH:
Use VuGen quick replace on ^! for \r\n
This works (see next screen shot as well):
AND this very long input string now looks just like the curl data used by the developers script:
One last step, which I will try and find the time to do, is to test this in earnest. I can't do this right now due to project time pressures, but it does look like it should work in earnest without issue.
LoadRunner VuGen script snippet (data input here taken from the developer's curl test script - for 'Body=')
web_add_auto_header("Accept-Encoding", "gzip, deflate, br");
web_add_auto_header("Accept-Language", "en-GB,en-US;q=0.8,en;q=0.6");
web_add_auto_header("content-type", "multipart/form-data; boundary=----WebKitFormBoundary34BFrWfsVy3");
web_add_auto_header("Accept", "*/*");
web_add_auto_header("Cache-Control", "no-cache");
sprintf(strtemp1,"Body=------WebKitFormBoundary34BFrWzVv48fsVy3
\r\n
Content-Disposition: form-data; name=
\"
which-animal-featured
\"\r\n\r\n
2
\r\n
------WebKitFormBoundary34BFrWzVv48fsVy3
\r\n
Content-Disposition: form-data;
\r\n
");
lr_start_transaction("dog_post");
web_custom_request("dog_post",
"URL=https://api-c.server.com/api?animal_type=dog&application_type=featured_application&animal_id=2",
"Method=POST",
"Resource=0",
"RecContentType=text/plain",
"Referer=http://v1-cp-.s3-website-eu-west-1.amazonaws.com/cleartheshelter/adopt.html?name=Oscar&id=2",
"Snapshot=t11.inf",
"Mode=HTTP",
strtemp1
,
LAST);
lr_end_transaction("dog_post",LR_AUTO);
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::