Skip to content
Compare
Choose a tag to compare
@zimeg zimeg released this 20 Mar 00:30
· 1 commit to main since this release
ba72343

What's Changed

This release adds the allowAbsoluteUrls option to the WebClient constructor.

For code using dynamic method names with .apiCall, this will toggle if requests should be sent to absolute URLs provided:

const { WebClient } = require('@slack/web-api');

const web = new WebClient(token, {
  allowAbsoluteUrls: false, // Default: true
});

const _response = await web.apiCall('https://example.com', { /* ... */ });
$ node index.js
[DEBUG]  web-api:WebClient:0 http request url: https://slack.com/api/https://example.com
...
[WARN]  web-api:WebClient:0 http request failed An HTTP protocol error occurred: statusCode = 404

The default allowAbsoluteUrls value is true to avoid a breaking change with this update, but we suggest deciding if this option should be applied to scripts and adjacent code.

Enhancements 🎉

  • feat(web-api): add configs to toggle absolute url usage in dynamic api calls in #2176 - Thanks @zimeg!

Maintenance 🧰

Full Changelog: https://github.com/slackapi/node-slack-sdk/compare/@slack/[email protected]...@slack/[email protected]
Milestone: https://github.com/slackapi/node-slack-sdk/milestone/131