ijpiantanida / talkback

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

Modify real request response to support Location header #18

Closed iverasp closed 5 years ago

iverasp commented 5 years ago

The use of a Location header seems unsupported in Talkback.

I have tried to use the responseDecorator to alter the Location header that is stored in the tape, but since the response when no tape is found is from the real server, the client will follow that URL instead of requesting Talkback. This results in no tapes being stored for the requests that follows the Location header. In order for the client to request Talkback when receiving a Location header, Talkback would need to alter the Location header before responding to the client even when no tapes are found.

The solution seems trivial after looking at src/request-handler.js, and I would be more than willing to create a PR for this functionality.

ijpiantanida commented 5 years ago

I changed responseDecorator to also apply to the request returned by the proxied server, which should cover your use case.

v1.9.0 contains this change.