Closed shuckster closed 3 months ago
Hi @shuckster, let me see if I understood your problem:
tempId
when making the POST requesttempId
to the recorded tempId
in the response, and in all future requests and responses.Both approaches you introduces sounds valid to me, but I believe that the HAR file will save the original requests (and will not take into consideration the changes you made to the data).
I think a nice approach for this problem could be abusing the postDataComparator
to store the tempId
once any request is having that field, and save both clientTempId
and backendTempId
(when update: flase
, both values will be different). then, I would use postDataComparator
and postProcess
to replace the new ID to the old one from the recording whenever it appears on any request / response.
What do you think?
Thanks for being an early-adopter of this library, your feedback is highly appreciated :1st_place_medal:
please re-open this issue if you have any further thoughts
Gosh, has it really been so long? Apologies for missing your message.
We're still using your project and managed to get around the issue above by having our ID generators be "seeded", and we would have hard-coded seeds for our tests.
Your project has been extremely useful and I'll certainly be in touch if something else comes up, so thank you again for your work.
That's so great to hear! Thank you for your feedback, keep updating! :)
First of all, thank you for this library.
The API I'm trying to mock has the following behaviour:
tempId
s for each entitytempId
s and echos them back in the responsefixedId
s at the same time, and on subsequent responsestempId
s on subsequent responsesI wouldn't be asking here if the solution was as easy as creating deterministic
tempId
s in the FE, which would almost certainly solve my issue, but I'm trying the following approaches.Given:
I want to try and perform the following intercepts for my HARs:
Essentially I want to either:
INTERCEPT_req
to rewrite thetempId
s and make them deterministic so that future HAR playback will pick up the right stored mocksplaywright-advanced-har
to exclude alltempId
s during recording, but useINTERCEPT_req
to conditionally enrichINTERCEPT_res
with thetempId
s the FE sendsHope this is reasonably clear, and thanks in advance for any advice!