Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
c7a851bb
Commit
c7a851bb
authored
Oct 03, 2016
by
Jeromy Johnson
Committed by
GitHub
Oct 03, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3276 from ipfs/kevina/adder-error-v2
Don't drop error in readStreamedJson.
parents
429decc9
6ae4edc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
commands/http/client.go
commands/http/client.go
+3
-2
No files found.
commands/http/client.go
View file @
c7a851bb
...
...
@@ -180,7 +180,7 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
// if output is coming from a channel, decode each chunk
outChan
:=
make
(
chan
interface
{})
go
readStreamedJson
(
req
,
rr
,
outChan
)
go
readStreamedJson
(
req
,
rr
,
outChan
,
res
)
res
.
SetOutput
((
<-
chan
interface
{})(
outChan
))
return
res
,
nil
...
...
@@ -233,7 +233,7 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
// read json objects off of the given stream, and write the objects out to
// the 'out' channel
func
readStreamedJson
(
req
cmds
.
Request
,
rr
io
.
Reader
,
out
chan
<-
interface
{})
{
func
readStreamedJson
(
req
cmds
.
Request
,
rr
io
.
Reader
,
out
chan
<-
interface
{}
,
resp
cmds
.
Response
)
{
defer
close
(
out
)
dec
:=
json
.
NewDecoder
(
rr
)
outputType
:=
reflect
.
TypeOf
(
req
.
Command
()
.
Type
)
...
...
@@ -245,6 +245,7 @@ func readStreamedJson(req cmds.Request, rr io.Reader, out chan<- interface{}) {
if
err
!=
nil
{
if
err
!=
io
.
EOF
{
log
.
Error
(
err
)
resp
.
SetError
(
err
,
cmds
.
ErrNormal
)
}
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment