ijpiantanida / talkback

A simple HTTP proxy that records and playbacks requests
MIT License
283 stars 41 forks source link

Question: Can users add arbitrary properties to `meta`? #48

Closed jmealo closed 3 years ago

jmealo commented 3 years ago

I'd like to record the actual request latency in the metadata. I cannot seem to persist any changes to meta in a responseDecorator. Is this intended?

ijpiantanida commented 3 years ago

There is currently no way of modifying the tape dynamically, which sounds like a good feature to add.

responseDecorator wouldn't work for this since it's only used to modify the response on the way out (either after the tape already got saved in the case of a new request or after finding an existing matching tape). The tape doesn't get persisted anymore at this point.

I will give some thought at implementing something like a tapeDecorator and update the issue.

ijpiantanida commented 3 years ago

@jmealo I just released v2.4.0 which introduces the tapeDecorator option and the matching context concept, which is needed if you want to track a request's latency.

You can see an example of both things working together here.

Thanks for using talkback.