Is webmock caching responses? #346

ehalferty opened this Issue Dec 17, 2013 · 0 comments


None yet
1 participant

I've tried using a lambda in my custom response:

        status: 200,
        body: lambda { |a| '{"access_token":"' + SecureRandom.hex(20) + '","token_type":"bearer","expires_in":"259200"}' }

Maybe this isn't the correct way to handle dynamic responses, but anyway, webmock seems to execute the lambda exactly once. The request is identical each time, so either:

  1. My asumption that using a lambda would allow me to generate dynamic content on a per-response basis was wrong.
  2. Because the repeated requests are identical, webmock just uses the last response it generated.

@ehalferty ehalferty closed this Dec 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment