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

Unable to pass data (and update POST data) between chained APIEasy calls. #55

Open
rvenugopal opened this issue Jul 25, 2013 · 3 comments

Comments

@rvenugopal
Copy link

Unable to pass data between chained APIEasy calls. This only works for outgoing headers. However, passing state to modify post request body of subsequent calls does not work. It appears that APIEasy is caching the post data to be sent at initialization and instead of late binding

Here is a gist with my use case
Failing use case

@domenic
Copy link

domenic commented Jul 28, 2013

Inspecting the source, it should work if you just do .post(url) instead of .post(url, data). Passing in a (currently-empty) data object will override the one set in your before:

http://flatiron.github.io/api-easy/#section-24

@domenic
Copy link

domenic commented Jul 28, 2013

Oh, sorry, you also need to set the body in the before. Add a line like outgoing.body = getPostData().

@tlianza
Copy link

tlianza commented May 29, 2015

I really wish I understood this answer, it would help me a lot. However, the first link is now broken. And, the second response says "set the body in the before" which I don't understand... doesn't that mean the code would run before every test in the suite, when all he's trying to do is chain 2 calls?

I was hoping the fluent nature of this library would make it easy to chain calls that depend on each other, but now I'm suspecting I misunderstood the benefits of this fluency.

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

No branches or pull requests

3 participants