Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Add the ability to intercept requests before they actually get sent #17

Closed
wants to merge 2 commits into from

Conversation

zackbloom
Copy link

I needed to add a body to requests. LMK if there is an existing way to do it, this is what I came up with. The last argument to whenCalledRemotely, and therefore all the functions which wrap it, can now be an object with callback and beforeRequest options.

This is fully backwards compatible when you pass a callback as before. When you use the new option, usage becomes:

lt.describe.whenCalledByUser USER, 'PUT', '/apps',
  beforeRequest: ->
    @http.send({orgId: 5})
  callback: ->
    lt.it.shouldBeDenied()

@slnode
Copy link

slnode commented Jun 10, 2014

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@bajtos
Copy link
Contributor

bajtos commented Jun 10, 2014

Hi @zackbloom, thank you for submitting the pull request.

There is already another pending PR implementing support for request bodies - see #15.
Is the implementation presented there good enough for what you need?

@zackbloom
Copy link
Author

Ah, I hadn't seen that. My thought was that having access to the http object would make it possible to do whatever other tweaks to the request might be necessary, but I don't actually have to do anything but include a body as of yet, so the other fix would work for me.

@bajtos
Copy link
Contributor

bajtos commented Jun 14, 2014

Closing in favour of #15, which was already released as v0.2.0.

@bajtos bajtos closed this Jun 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants