-
Notifications
You must be signed in to change notification settings - Fork 299
Response body is empty if X-Chunked-Output header is set #696
Comments
If this is too vague, I've pushed a branch, showing that issue: https://github.com/ipfs/js-ipfs-api/tree/issue-696 Check it out and run:
Compare those code paths with (where things work as expected):
The |
@pgte will have a clear answer here as he refactored the send-request.js code last. If not I'm happy to dive deep into this with you. |
on it. |
@vmx I think I know what the problem is. Perhaps you could, instead of using a file-specific API, try using directly the @vmx Makes sense? |
@pgte Thanks for the quick reply, it makes sense.
Could the converter be renamed? Just "converter" sounds so general purpose (hence I didn't really spot it as an issue). Would it make sense to rename it to something like |
@vmx Agree, should be renamed for clarity, I would say something like |
@pgte I had another look. So |
Well,
|
So Does this mean Please don't get me wrong. My goal is to take the chance that I'm new to the code base to clean up the API a bit to make it easier to follow/understand/use. |
@vmx good point, you're absolutely right!
@vmx thoughts? |
@pgte I would follow Python's "explicit is better than implicit". That would mean that each endpoint would add its converter as an option. |
@vmx I'm all for it 👍, I also prefer explicit rather than these nasty surprises.. |
@pgte Will you be working on this? |
@vmx I didn't plan to, but I can help you review this is you're interested.. |
The `SendFilesStream` used to run the `FileStreamConverter` automatically. With making it an option to use a converter, `SendFilesStream` can be used outside of the Files API, e.g. for the DAG API. Closes #696.
The `SendFilesStream` used to run the `FileResultStreamConverter` automatically. With making it an option to use a converter, `SendFilesStream` can be used outside of the Files API, e.g. for the DAG API. Closes #696.
Is there a fix incoming for this issue ? It's going to be blocking for me quite soon. |
@MichaelMure Yes, the fix is at #701. Things are currently kind of blocked due to the CI failing. Getting the tests working again is currently my top priority. |
Awesome, thanks :) |
When the
X-Chunked-Output: 1
header is set, then the body of a HTTP request isn't passed along correctly.Line 34 in send-request.js it's responsible for a different code path is
X-Chunked-Output: 1
is set. This relates to ipfs/kubo#4721.If this code path is taken then there's no
streamToJsonValue
transformation taken (https://github.com/ipfs/js-ipfs-api/blob/de8d97c953447b605e2a1de68d198b5372419724/src/utils/send-request.js#L68). Thesend()
at https://github.com/ipfs/js-ipfs-api/blob/de8d97c953447b605e2a1de68d198b5372419724/src/utils/send-files-stream.js#L112-L148 has aDestroyableTransform
asresponse
. When the code reaches line 113, it does contain the expected body. But that body doesn't make it to here: https://github.com/maxogden/concat-stream/blob/e482281642c1e011fc158f5749ef40a71c77a426/index.js#L36.As opposed to the code path when
X-Chunked-Output
is not set. Then the body at https://github.com/maxogden/concat-stream/blob/e482281642c1e011fc158f5749ef40a71c77a426/index.js#L36 contains the expected value.The text was updated successfully, but these errors were encountered: