-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: remove ky from http-client and utils #2810
Conversation
Looks good so far 👍 |
if (options.chunker) searchParams.set('chunker', options.chunker) | ||
if (options.cidVersion) searchParams.set('cid-version', options.cidVersion) | ||
if (options.cidBase) searchParams.set('cid-base', options.cidBase) | ||
if (options.enableShardingExperiment != null) searchParams.set('enable-sharding-experiment', options.enableShardingExperiment) | ||
if (options.hashAlg) searchParams.set('hash', options.hashAlg) | ||
if (options.onlyHash != null) searchParams.set('only-hash', options.onlyHash) | ||
if (options.pin != null) searchParams.set('pin', options.pin) | ||
if (options.progress) searchParams.set('progress', true) | ||
if (options.quiet != null) searchParams.set('quiet', options.quiet) | ||
if (options.quieter != null) searchParams.set('quieter', options.quieter) | ||
if (options.rawLeaves != null) searchParams.set('raw-leaves', options.rawLeaves) | ||
if (options.shardSplitThreshold) searchParams.set('shard-split-threshold', options.shardSplitThreshold) | ||
if (options.silent) searchParams.set('silent', options.silent) | ||
if (options.trickle != null) searchParams.set('trickle', options.trickle) | ||
if (options.wrapWithDirectory != null) searchParams.set('wrap-with-directory', options.wrapWithDirectory) | ||
if (options.preload != null) searchParams.set('preload', options.preload) | ||
if (options.fileImportConcurrency != null) searchParams.set('file-import-concurrency', options.fileImportConcurrency) | ||
if (options.blockWriteConcurrency != null) searchParams.set('block-write-concurrency', options.blockWriteConcurrency) |
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.
It's nice that this is much DRYer now
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.
We can resolve this comment thread
@hugomrdias What work remains before this PR will leave the draft stage? Thanks! |
headers: config.headers, | ||
base: normalizeURL(config).toString(), | ||
handleError: errorHandler, | ||
// apply two mutations camelCase to kebad-case and remove undefined/null key/value pairs |
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.
// apply two mutations camelCase to kebad-case and remove undefined/null key/value pairs | |
// apply two mutations camelCase to kebab-case and remove undefined/null key/value pairs |
throw error | ||
} | ||
|
||
var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g |
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.
Might be helpful to insert a comment above this line explaining in plain text what this regex is intended to catch beyond A-Z
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.
@hugomrdias Curious for your thoughts on this when you get a chance. Thanks!
url.port = config.port || location.port | ||
} else { | ||
url.host = config.host || 'localhost' | ||
url.port = config.port || '5001' |
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.
Defaults to go-ipfs
rather than js-ipfs
(5002)?
Once |
0b7a5fd
to
1c619bb
Compare
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.
This is a monster. Let's get it in and address any problems with follow up PRs.
headers: opts.headers, | ||
base: normalizeInput(opts.url).toString(), | ||
handleError: errorHandler, | ||
// apply two mutations camelCase to kebad-case and remove undefined/null key/value pairs |
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.
// apply two mutations camelCase to kebad-case and remove undefined/null key/value pairs | |
// apply two mutations camelCase to kebab-case and remove undefined/null key/value pairs |
I didn't mean merge while CI was red 🤣 |
fixing it, for some reason i just so green 🤣 |
- we now use a simpler http lib - bundle size reduced - some tests are now more stable - search params handling is cleaner closes ipfs#2801
- we now use a simpler http lib - bundle size reduced - some tests are now more stable - search params handling is cleaner closes #2801
This PR removes ky and simplifies a couples things searchParams handling, baseUrl normalization and native fetch options usage.
Native fetch options can be passed into the contructor or methods and are merged properly, methods now use the third argument to receive these options.
left some comments in the code to explain some of the ideas, please review so i can continue refactoring if approved.
No support for retries or hooks will implement as needed.
closes #2801
related
https://github.com/ipfs/interface-js-ipfs-core/issues/58