Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcr-clj.core/with-cassette supports :arg-transformer option #22

Merged
merged 1 commit into from
Apr 17, 2017

Conversation

chairmank
Copy link
Contributor

I added a new :arg-transformer option that is analogous to the existing
:return-transformer option. During both recording and playback, the original
arguments are interepted and replaced by (apply return-transformer args), and
these transformed arguments are passed to arg-key-fn, recordable?, and the
recorded function.

This feature is intended to enable serialization of HTTP request bodies for
#17

Copy link
Owner

@gfredericks gfredericks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why the build didn't run for the PR

arguments to the function call are passed through this
transformer, and the transformed arguments are passed
to arg-key-fn, recordable? and the recorded function.
Defaults to clojure.core/identity.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should identity be vector here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. I'll change the docstring.

@@ -87,6 +88,27 @@
:arg-key-fn #(mod % 2)}]
(is (= 42 (increment 29)))))

(deftest arg-transformer-test
(with-spy [put-foo]
(with-cassette :shebang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good cassette name

@chairmank
Copy link
Contributor Author

I rebased on the current HEAD of master branch and fixed the mistake in the docstring.

I added a new `:arg-transformer` option that is analogous to the existing
`:return-transformer` option. During both recording and playback, the original
arguments are intercepted and replaced by `(apply return-transformer args)`,
and these transformed arguments are passed to `arg-key-fn`, `recordable?`, and
the recorded function.

This feature is intended to enable serialization of HTTP request bodies for
gfredericks#17
@gfredericks gfredericks merged commit 5e1f367 into gfredericks:master Apr 17, 2017
@gfredericks
Copy link
Owner

Released as 0.4.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants