Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

test: add test for retrieving an empty block #308

Merged
merged 1 commit into from
Jun 22, 2018

Conversation

alanshaw
Copy link
Contributor

Add an empty block and ensure we can get it back successfully. Test for ipfs-inactive/js-ipfs-http-client#789

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
@ghost ghost assigned alanshaw Jun 21, 2018
@ghost ghost added the in progress label Jun 21, 2018
alanshaw added a commit to ipfs/js-ipfs that referenced this pull request Jun 21, 2018
This PR allows the test in ipfs-inactive/interface-js-ipfs-core#308 to pass.

X-Stream-Output header is added to block.get reply for parity with go-ipfs.

block.put is altered to allow an empty block to be put (again for fetaure parity with go-ipfs) but only if there is a multipart file part for it. Error responses have also been improved.

refs ipfs-inactive/js-ipfs-http-client#789
tested by ipfs-inactive/interface-js-ipfs-core#308

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
Copy link
Contributor

@travisperson travisperson left a comment

Choose a reason for hiding this comment

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

LGTM

One side note: Should this assert the CID of an empty block? It should be consistent across implementations so it seems like it might be worth adding.

@alanshaw
Copy link
Contributor Author

Yes, perhaps as a separate test in block.put?

@travisperson
Copy link
Contributor

Ah yes, that can come in later. Missed that this was a get test.

@alanshaw alanshaw merged commit fbedbb9 into master Jun 22, 2018
@ghost ghost removed the in progress label Jun 22, 2018
@alanshaw alanshaw deleted the test/add-empty-block-test branch June 22, 2018 07:57
alanshaw added a commit that referenced this pull request Jun 22, 2018
Added originally in #308

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
alanshaw added a commit to ipfs/js-ipfs that referenced this pull request Jun 26, 2018
* fix: allow put empty block & add X-Stream-Output header on get

This PR allows the test in ipfs-inactive/interface-js-ipfs-core#308 to pass.

X-Stream-Output header is added to block.get reply for parity with go-ipfs.

block.put is altered to allow an empty block to be put (again for fetaure parity with go-ipfs) but only if there is a multipart file part for it. Error responses have also been improved.

refs ipfs-inactive/js-ipfs-http-client#789
tested by ipfs-inactive/interface-js-ipfs-core#308

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* chore: update interface-ipfs-core dependency

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* chore: update ipfs-api dependency

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* chore: fix the hack, open the repo not the datastore

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
alanshaw added a commit that referenced this pull request Jun 26, 2018
Added originally in #308

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants