Skip to content

Releases: elbywan/wretch

2.5.0

20 Feb 22:56
Compare
Choose a tag to compare

2.5.0 (2023-02-20)

🏭 New feature(s)

  • Parse error type as json on proper content-type (ea9adbf), closes #171

Setting the error type as json manually using .errorType("json") should now not be necessary if the server responds with a Content-Type header set as application/json.

The response body will be deserialized and the error.json will be set accordingly.

⬆️ Version update(s)

  • Bump @fastify/multipart from 7.3.0 to 7.4.1 (e6074c9)
  • Bump @sideway/formula from 3.0.0 to 3.0.1 (8208646)
  • Bump ua-parser-js from 0.7.31 to 0.7.33 (1694fe6)

2.4.1

20 Jan 15:54
Compare
Choose a tag to compare

2.4.1 (2023-01-20)

🐛 Bug fix(es)

  • Fix abort/progress addons state isolation issue (2b3a659)

2.4.0

19 Jan 14:20
Compare
Choose a tag to compare

2.4.0 (2023-01-19)

🏭 New feature(s)

  • Add skip argument to the retry middleware (746f8c9)
wretch().middlewares([
  retry({
    skip(url, options) {
      return options.method != "GET"
    },
  })
])

2.3.2

11 Jan 13:24
Compare
Choose a tag to compare

2.3.2 (2023-01-11)

🐛 Bug fix(es)

Allows defining global error catchers using resolvers:

const request = wretch(baseURL)
  .errorType("json")
  .resolve((response) => {
    return (
      response
        .error("Error", (error) => {
          console.log("global catch (Error class)");
        })
        .error("TypeError", (error) => {
          console.log("global type error catch (TypeError class)");
        })
    );
  });

await request
  .get(`/carts/v3/${cartId}/payment/modes`)
  // Will override the global catcher now thanks to this fix.
  .notFound((error) => {
    console.log("not found");
  })
  .json();

2.3.1

07 Jan 21:45
Compare
Choose a tag to compare

2.3.1 (2023-01-07)

🐛 Bug fix(es)

  • Fix middlewares and addons subpath exports (bfd2542), closes #160

📝 Documentation update(s)

  • Add limitations section to the readme (ad0a102), closes #159

2.3.0

12 Dec 20:41
Compare
Choose a tag to compare

2.3.0 (2022-12-12)

🏭 New feature(s)

  • Add url property to WretchError (a1f6ac6), closes #157

2.2.3

09 Dec 07:09
Compare
Choose a tag to compare

2.2.3 (2022-12-09)

🐛 Bug fix(es)

  • Better error catching precedence (107fc71), closes #155

2.2.2

03 Dec 14:53
Compare
Choose a tag to compare

2.2.2 (2022-12-03)

🐛 Bug fix(es)

  • Fix compatibility issue between the perfs and progress addons (b70e8cd)

2.2.1

03 Dec 10:36
Compare
Choose a tag to compare

2.2.1 (2022-12-03)

🐛 Bug fix(es)

  • Add missing export for the progress addon (ebb0577)
  • Add missing progress addon rollup config (bd6c89b)
  • Register the progress addon in the .all entry point (b01e03d)

2.2.0

03 Dec 10:24
Compare
Choose a tag to compare

2.2.0 (2022-12-03)

🏭 New feature(s)

Add progress addon (2bae524), closes #154

Wretch now accepts a callback to monitor download progress.

🔗 Documentation.

import ProgressAddon from "wretch/addons/progress"
 
wretch("some_url")
  // Register the addon
  .addon(ProgressAddon())
  .get()
  // Log the progress as a percentage of completion
  .progress((loaded, total) => console.log(`${(loaded / total * 100).toFixed(0)}%`))

⬆️ Version update(s)

  • Bump dependencies including outdated rollup plugins (bcbcdc5)
  • Bump engine.io from 6.2.0 to 6.2.1 (6a93854)
  • Bump fastify from 4.9.2 to 4.10.2 (8ae9122)

🎨 Code improvement(s)

🐛 Bug fix(es)

  • Fix a minor Wretch type issue in addons (23ba7b1)