Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
4022d8b8
提交
4022d8b8
authored
10月 27, 2015
作者:
Juan Benet
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1885 from ipfs/fix/ndjson
put newlines between streaming json output objects
上级
49684ea4
f130869b
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
42 行增加
和
4 行删除
+42
-4
response.go
commands/response.go
+1
-0
expected_getOut
test/sharness/t0051-object-data/expected_getOut
+1
-2
t0200-unixfs-ls.sh
test/sharness/t0200-unixfs-ls.sh
+2
-2
t0231-channel-streaming.sh
test/sharness/t0231-channel-streaming.sh
+38
-0
没有找到文件。
commands/response.go
浏览文件 @
4022d8b8
...
...
@@ -47,6 +47,7 @@ func marshalJson(value interface{}) (io.Reader, error) {
if
err
!=
nil
{
return
nil
,
err
}
b
=
append
(
b
,
'\n'
)
return
bytes
.
NewReader
(
b
),
nil
}
...
...
test/sharness/t0051-object-data/expected_getOut
浏览文件 @
4022d8b8
{
"Links": [],
"Data": "\u0008\u0002\u0012\nHello Mars\u0018\n"
}
\ No newline at end of file
}
test/sharness/t0200-unixfs-ls.sh
浏览文件 @
4022d8b8
...
...
@@ -122,7 +122,7 @@ test_ls_cmd() {
}
}
EOF
printf
%s
"$(cat expected_json_ls_file_trailing_newline)" >expected_json_ls_file &&
printf
"%s\n"
"$(cat expected_json_ls_file_trailing_newline)" >expected_json_ls_file &&
test_cmp expected_json_ls_file actual_json_ls_file
'
...
...
@@ -168,7 +168,7 @@ test_ls_cmd() {
}
}
EOF
printf
%s
"$(cat expected_json_ls_duplicates_file_trailing_newline)" >expected_json_ls_duplicates_file &&
printf
"%s\n"
"$(cat expected_json_ls_duplicates_file_trailing_newline)" >expected_json_ls_duplicates_file &&
test_cmp expected_json_ls_duplicates_file actual_json_ls_duplicates_file
'
}
...
...
test/sharness/t0231-channel-streaming.sh
0 → 100755
浏览文件 @
4022d8b8
#!/bin/sh
#
# Copyright (c) 2015 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test output of streaming json commands"
.
lib/test-lib.sh
test_init_ipfs
get_api_port
()
{
cat
"
$IPFS_PATH
/api"
| awk
-F
/
'{ print $5 }'
}
test_ls_cmd
()
{
test_expect_success
"make a file with multiple refs"
'
HASH=$(random 1000000 | ipfs add -q)
'
test_expect_success
"can get refs through curl"
'
PORT=$(get_api_port) &&
curl http://localhost:$PORT/api/v0/refs/$HASH > output
'
# make sure newlines are printed between each object
test_expect_success
"output looks good"
'
test_expect_code 1 grep "}{" output > /dev/null
'
}
# should work online (only)
test_launch_ipfs_daemon
test_ls_cmd
test_kill_ipfs_daemon
test_done
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论