Skip to content

2.9.0

Compare
Choose a tag to compare
@elbywan elbywan released this 01 Jun 17:36
· 26 commits to master since this release

What's Changed

🏭 New feature(s)

import BasicAuthAddon from "wretch/addons/basicAuth"

const user = "user"
const pass = "pass"

// Automatically sets the Authorization header to "Basic " + <base64 encoded credentials>
wretch("...").addon(BasicAuthAddon).basicAuth(user, pass).get()

// Allows using URLs with credentials in them
wretch(`https://${user}:${pass}@...`).addon(BasicAuthAddon).get()
  • 🏭 Omit null and undefined values from query string produced by QueryStringAddon by @dankochetov in #230
wretch('https://example.com')
  .addon(QueryStringAddon)
  // passing 'true' as the third argument will now ignore query parameters having undefined/null values
  // the underlying url is now `https://example.com?bar=qwe` and foo is omitted
  .query({ bar: 'qwe', foo: undefined }, false, true)

🐛 Bug fix(es)

  • 🐛 Do not jasonify FormData instances by @am1rb in #232
const requestBody = new FormData()
requestBody.append("field1", "data 1");
requestBody.append("field2", "data 2");

// wretch will now check if the argument is an instance of `FormData` before trying to jsonify it
wretch().post(requestBody, "SERVER_URL")

⬆️ Version update(s)

  • ⬆️ Bump follow-redirects from 1.15.4 to 1.15.6 by @dependabot in #224

New Contributors

Full Changelog: 2.8.1...2.9.0