Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Feature: Method getLast for moxios.requests #3

Open
anilanar opened this issue May 27, 2018 · 0 comments
Open

Feature: Method getLast for moxios.requests #3

anilanar opened this issue May 27, 2018 · 0 comments

Comments

@anilanar
Copy link
Owner

From moxios created by fenderil : axios#47

Hello there.

It will be cool to add method getLast, that takes reverse array of moxios.requests and returns last of found.

It is valuable as mostRecent method in cases with splitting multiple logic inside moxios.wait method.

Example:

moxios.wait(() => {
  moxios
    .requests
    .getLast('post', '/foo')
    .respondWith(fooResponse)
    .then(doSomething)

  moxios
    .requests
    .getLast('post', '/bar')
    .respondWith(barResponse)
    .then(doSomething)
})
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant