Skip to content

!feat: use fetch instead of superagent (closes #552) - #555

Open
Justin Hammond (Justintime50) wants to merge 4 commits into
masterfrom
EXP-1224_fetch_over_superagent
Open

!feat: use fetch instead of superagent (closes #552)#555
Justin Hammond (Justintime50) wants to merge 4 commits into
masterfrom
EXP-1224_fetch_over_superagent

Conversation

@Justintime50

@Justintime50 Justin Hammond (Justintime50) commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

  • Drops Node 16 support as fetch is only in Node 18+
  • Breaking: HTTP transport migrated from superagent to fetch-compatible transport
    • superagent runtime dependency removed
    • Breaking: superagentMiddleware renamed to httpMiddleware
    • Breaking: fetchClient renamed to httpClient
    • Breaking: makeApiCall now accepts delete (the del alias was removed)
    • requestMiddleware compatibility preserved using a fetch-era compatibility request object
    • Default User-Agent retains structured runtime metadata fields (Nodejs/, OS/, OSVersion/, OSArch/) via runtime-safe detection

Closes #552

Testing

Pull Request Type

Please select the option(s) that are relevant to this PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement (fixing a typo, updating readme, renaming a variable name, etc)

@Justintime50
Justin Hammond (Justintime50) marked this pull request as ready for review July 31, 2026 17:06

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few non-blocking clarifications.

Comment thread UPGRADE_GUIDE.md
- `superagent` is no longer a runtime dependency.
- Node 18+ is now required (built-in `fetch`).
- `superagentMiddleware` has been removed and replaced by `httpMiddleware`.
- `fetchClient` has been renamed to `httpClient`.

@copiousfreetime Jeremy Hinegardner (copiousfreetime) Aug 3, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be agent has been renamed to httpClient?

Comment thread src/easypost.js
this.timeout = timeout || EasyPostClient.DEFAULT_TIMEOUT;
this.baseUrl = baseUrl || EasyPostClient.DEFAULT_BASE_URL;
this.agent = superagent;
this.httpClient =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the rename that you're talking about in the Upgrade Guide right ?


expect(address.verifications.delivery.errors[0].message).to.equal('Address not found');
expect(address.verifications.zip4.errors[0].message).to.equal('Address not found');
return client.Address.createAndVerify(addressData).catch((err) =>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test changes what it tests -- its now checking that there is an exception on create and Verify instead of the address being a valid object, and the errors are in that object. Is this a behavior change in the api?

@@ -32,32 +32,6 @@ describe('CarrierAccount Service', function () {
await client.CarrierAccount.delete(carrierAccount.id);
});

it('creates a carrier account with a custom workflow', async function () {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this test removal?

Comment thread CHANGELOG.md
- Breaking: HTTP transport migrated from `superagent` to fetch-compatible transport
- `superagent` runtime dependency removed
- Breaking: `superagentMiddleware` renamed to `httpMiddleware`
- Breaking: `fetchClient` renamed to `httpClient`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be agent renamed to httpClient ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Migrate HTTP transport from superagent to fetch for edge-runtime compatibility

2 participants