Releases: elbywan/wretch
Releases · elbywan/wretch
2.5.0
2.5.0 (2023-02-20)
🏭 New feature(s)
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)
2.4.1
2.4.0
2.3.2
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
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.2.0 (2022-12-03)
🏭 New feature(s)
Add progress addon (2bae524), closes #154
Wretch now accepts a callback to monitor download progress.
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)
- Add a prepare script (17b0a76)
🐛 Bug fix(es)
- Fix a minor Wretch type issue in addons (23ba7b1)