-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch to 'cross-fetch' instead of 'request' #6
Conversation
…witch to WHATWG URL; switch thrift-client to use cross-fetch instead of request
…her request imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! just some minor questions.
packages/thrift-integration/src/client/connections/index.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow review. Thanks for making these changes! It looks like there's a lot of good common-sense changes.
I'm not familiar with cross-fetch but I looked at it for a few minutes. Is it fair to say that it's a pretty small library, and it just proxies through to either a node implementation or a browser implementation depending on where it's running?
packages/thrift-integration/src/client/connections/HttpConnection.spec.ts
Outdated
Show resolved
Hide resolved
Thanks for reviewing! |
Thanks for reviewing!
Yep, it just packages a browser implementation that uses the |
…merging of options, adding unit tests for thrift-client, cleaning up some code
I'm going to merge so that I'm not blocked on the webpack 5 front anymore, but if anyone has any more comments or suggestions, I can address those in a separate PR. Thanks! |
request
withcross-fetch
, and isomorphic fetch libraryRequestOptions
type is a mix of the browser andnode-fetch
options, so that server-side code can set things like theagent
for keepalive, but it should have no effect in browser codelodash
dependency was removed from thethrift-server-core
library, because all it was used for was doing "deep merges" on the client, which weren't needed. Instead, a new function to merge together request options was added, with special logic for theHeaders
values (which can't utilize object spread).response.arrayBuffer()
function is used to get anArrayBuffer
and convert the binary response into a NodeBuffer
, which is what the generated code expects to use when sending requests through the connection. We'll need to polyfill that with Webpack, but it should be just fine.url.parse
andurl.format
deprecated functions and replaced them with the WHATWG URL API