intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
119 stars 153 forks source link

Continue Axios Migration #150

Closed benflap closed 4 months ago

benflap commented 7 months ago

Fixes: #143

Axios is not a drop-in replacement for Popsicle. Here are a few of the API differences:

Breaking Change

Given the transport issue, this PR does introduce a breaking change. Users that receive a PDF will have to change their code from this:

oauthClient.makeApiCall({
  url: `${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59`,
  headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'},
  transport: popsicle.createTransport({type: 'buffer'})
})

To this:

oauthClient.makeApiCall({
  url: `${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59`,
  headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'},
  responseType: 'arraybuffer'
})

In my opinion, switching to Axios is still worth it.

Testing

The only things I use this package for are creating redirects and creating tokens, so those are the only things I've tested. Other users should test out the rest of the package before this PR is merged.

rajeshgupta723 commented 4 months ago

Thanks for raising this PR for migrating to Axios from Popsicle. Few comments,