light-my-request

Fake HTTP injection library

OTHER License

Downloads
7.5M
Stars
310
Committers
66

Bot releases are hidden (Show)

light-my-request - v2.0.1

Published by mcollina almost 7 years ago

  • Updated ajv to 6.0.0.
light-my-request - v2.0.0

Published by delvedor almost 7 years ago

  • Added error handling - #10 #11

v1

// callback
inject(dispatch, { method: 'get', url: '/' }, (res) => {
  console.log(res.payload)
})

// promises
inject(dispatch, { method: 'get', url: '/' })
  .then(res => console.log(res.payload))

// async-await
const res = await inject(dispatch, { method: 'get', url: '/' })
console.log(res.payload)

v2

// callback
inject(dispatch, { method: 'get', url: '/' }, (err, res) => {
  console.log(res.payload)
})

// promises
inject(dispatch, { method: 'get', url: '/' })
  .then(res => console.log(res.payload))
  .catch(console.log)

// async-await
try {
  const res = await inject(dispatch, { method: 'get', url: '/' })
  console.log(res.payload)
} catch (err) {
  console.log(err)
}
light-my-request - v1.1.2

Published by delvedor almost 7 years ago

  • Use safe-buffer for Node 4 compatibility (fix #8) - #9
light-my-request - v1.1.1

Published by delvedor almost 7 years ago

  • Set content length to string - #5
light-my-request - v1.1.0

Published by delvedor almost 7 years ago

  • Bind a server instance to dispatchFunc - #4
light-my-request - v1.0.0

Published by delvedor about 7 years ago

Initial release.