Open marcellomaugeri opened 5 months ago
I have experienced the same problem some months ago without a solution
@marina-p could you please confirm if this is a bug? I would be glad to fix it with some guidance, thank you.
Hello @marcellomaugeri,
Apologies for the delay in replying and thank you for the self-contained repro steps. In the above files, the dictionary and custom value generators have a different path:
"/request/post/__body__": gen_restler_custom_payload__request_post__body_
"/test/post/__body__": ["{\n\"test\" : \"test\"\n}"]
If I modify both keys to match the Swagger (/test/post/__body__
), RESTler sends both values generated by the custom value generator function.
Thanks,
Marina
@marcellomaugeri leaving this issue open to further brainstorm how to improve diagnosing this error. There isn't a warning issued today for unused value generators since one use case is to have the same value_gen.py for many Swagger files, which would result in noisy warnings.
@marina-p thank you for your solution. Actually, I made a mistake in providing the MRE, but the paths are all correct in my code. Still, it's sending the first value in the yield: { "test": "test1" }
at the beginning, all the remaining payloads are just random strings, not taking into consideration neither dict nor other values in the generator. I was expecting Restler to send { "test": "test1" }
and { "test": "test2" }
alternated.
In brief, I would like to have full control of the payload sent, is it possible?
Description
I am trying to use a custom generator to dynamically generate the body of a POST request to the path /request, however, only the first request contains the value of the custom_generator.py. All the rest of the queries are random strings.
Steps to reproduce
Swagger.json
Dict.json
custom_generator.py
engine_settings.json
config.json
Commands:
Expected results
Alternating between the two bodies defined in custom_generator.py
Actual results
Only the first value defined in custom_generator is sent.
Environment details
Ubuntu 22.04, Python 3.10.12, dotnet 6.0.126, RESTler 9.2.3