ijpiantanida / talkback

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

New feature: Ignore parts of the url #14

Closed xjohannes closed 5 years ago

xjohannes commented 5 years ago

The problem:

We have urls that are created from previous server responses like: http://localhost:8081/payments/${paymentId}/transactions/${transactionId}/import where http://localhost:8080 is the host key in the options object and /${paymentId}/transactions/${transactionId}/import is the url key in the recorded tapes.

As far as I understand, Talkback uses the url key when matching tapes. This will force a new call to the real server for every new variable value.

A solution:

A solution is to introduce a url/pathname matcher property, where one could replace the variables with fixed values. I guess its much the same solution as you did with the bodyMatcher.

ijpiantanida commented 5 years ago

I just released v1.7.0 which adds the urlMatcher option. As you suggested, it works in the same way as the bodyMatcher option.

You can see it under use in the example folder.

Thanks for the suggestion.

xjohannes commented 5 years ago

Thank you. I'm really impressed with the speed with which you deliver new features.