This repository was archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 296
add opts param to IpfsAPI, allow 'protocol' config #67
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b138ee1
add opts to constructor
ckeenan 8babda6
parse mocha test files from karma config
ckeenan bbcdd5b
new test/constructor.js parameter tests
ckeenan 35d7b19
chore: build
ckeenan b5c63df
update readme with opts info
ckeenan 3f841b9
fix(config): send correct user-agent
dignifiedquire a0a487f
rename tests to *.spec.js for easy globbing
ckeenan 697899f
add opts to constructor
ckeenan 2ad3d3d
parse mocha test files from karma config
ckeenan a4514ae
new test/constructor.js parameter tests
ckeenan 5547c07
chore: build
ckeenan ece0634
update readme with opts info
ckeenan ed11c60
rename tests to *.spec.js for easy globbing
ckeenan 0270462
Merge branch 'extra-opts' of https://github.com/ckeenan/node-ipfs-api…
ckeenan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict' | ||
|
||
const ipfsAPI = require('../src/index.js') | ||
const assert = require('assert') | ||
|
||
describe('ipfsAPI constructor tests', () => { | ||
describe('parameter permuations', () => { | ||
const apiAddrs = require('./tmp-disposable-nodes-addrs.json') | ||
const apiAddr = apiAddrs.a.split('/') | ||
|
||
function clientWorks (client, done) { | ||
client.id((err, res) => { | ||
if (err) throw err | ||
const id = res | ||
assert(id.ID) | ||
assert(id.PublicKey) | ||
done() | ||
}) | ||
} | ||
|
||
it('opts', (done) => { | ||
clientWorks(ipfsAPI({ | ||
host: apiAddr[2], | ||
port: apiAddr[4], | ||
protocol: 'http' | ||
}), done) | ||
}) | ||
|
||
it('mutliaddr, opts', (done) => { | ||
clientWorks(ipfsAPI( | ||
apiAddrs.a, | ||
{protocol: 'http'} | ||
), done) | ||
}) | ||
|
||
it('host, port', (done) => { | ||
clientWorks(ipfsAPI( | ||
apiAddr[2], | ||
apiAddr[4] | ||
), done) | ||
}) | ||
|
||
it('host, port, opts', (done) => { | ||
clientWorks(ipfsAPI( | ||
apiAddr[2], | ||
apiAddr[4], | ||
{protocol: 'http'} | ||
), done) | ||
}) | ||
}) | ||
}) |
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not entirely clear what you are doing above could you explain please?
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 preventing config.host or config.port from being set to the opts object, thus preserving the defaults if needed
Setting host or port to opts is not problematic if you set host or port in opts. If those aren't set the defaults are overridden with the opts object and we can't connect
e.g. so
ipfsAPI({protocol: 'http'})
will work