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-unixfs
Commits
5589021a
Commit
5589021a
authored
Jan 18, 2015
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/http: Fixed panics when unmarshaling command output without a set Command.Type
parent
452f54a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
commands/http/client.go
commands/http/client.go
+19
-6
No files found.
commands/http/client.go
View file @
5589021a
...
...
@@ -153,8 +153,14 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
outputType
:=
reflect
.
TypeOf
(
req
.
Command
()
.
Type
)
for
{
v
:=
reflect
.
New
(
outputType
)
.
Interface
()
err
:=
dec
.
Decode
(
v
)
var
v
interface
{}
var
err
error
if
outputType
!=
nil
{
v
=
reflect
.
New
(
outputType
)
.
Interface
()
err
=
dec
.
Decode
(
v
)
}
else
{
err
=
dec
.
Decode
(
&
v
)
}
if
err
!=
nil
&&
err
!=
io
.
EOF
{
fmt
.
Println
(
err
.
Error
())
return
...
...
@@ -200,13 +206,20 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
}
else
{
outputType
:=
reflect
.
TypeOf
(
req
.
Command
()
.
Type
)
v
:=
reflect
.
New
(
outputType
)
.
Interface
()
err
=
dec
.
Decode
(
v
)
var
v
interface
{}
if
outputType
!=
nil
{
v
=
reflect
.
New
(
outputType
)
.
Interface
()
err
=
dec
.
Decode
(
v
)
}
else
{
err
=
dec
.
Decode
(
&
v
)
}
if
err
!=
nil
&&
err
!=
io
.
EOF
{
return
nil
,
err
}
res
.
SetOutput
(
v
)
if
v
!=
nil
{
res
.
SetOutput
(
v
)
}
}
return
res
,
nil
...
...
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