Skip to content
This repository was archived by the owner on Jun 3, 2020. It is now read-only.

Releases: swlkr/req

🐈 📦 better timeouts and you

17 Oct 23:42
Compare
Choose a tag to compare

I had a problem where sending "{}" returned some unexpected results sometimes, so xhr.send() will only send a body if there is one.

I also decided to use yarn even though there's only two dependencies for testing and zero runtime dependencies.

This release also marks the first release where timeouts are handled correctly by not relying on ontimeout but instead using setTimeout()

Broken tests

26 Sep 21:33
Compare
Choose a tag to compare
  • Made the decision to go ahead and set any POST, PUT or PATCH bodies to {} when they're passed in as null

This happens for a decent reason. When xhr.send() is called, instead of JSON.stringify(null) -> "null" or JSON.stringify(undefined) -> "undefined", instead it's JSON.stringify({}) -> "{}" as the body of the request

Requests are data

26 Sep 21:31
Compare
Choose a tag to compare

2.0.0! Requests as data

The whole api has changed. Http requests are just js objects now. Which is a good thing for a few reasons.

  1. The functions that operate on them in the library are now pure functions, meaning it was easier for me to focus on and test potential invalid data than it was before.
  2. The "arguments" are now named, I mean if you consider a js object as one argument naming arguments.
  3. It should be easier to wrap this library since the data coming into it is just that: data.

Initial commit

19 Sep 17:32
Compare
Choose a tag to compare

This is the first release of req. Despite the relatively small number of commits (two), this lib is currently used in production.

This library effectively acts an easier to use wrapper around xmlhttprequest which allows you to send json using promises to a server very easily.

The api will not change in the future. New functions might be added, but that's about it.

Enjoy 1.0.0!