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-cmds
Commits
33b16352
Commit
33b16352
authored
Dec 01, 2014
by
Matt Bell
Committed by
Brian Tiger Chow
Dec 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/http: Fixed client panic when sending a Request with nil 'Files'
parent
fd9e4610
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
http/client.go
http/client.go
+8
-1
No files found.
http/client.go
View file @
33b16352
...
...
@@ -48,14 +48,21 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
}
var
fileReader
*
MultiFileReader
var
reader
io
.
Reader
if
req
.
Files
()
!=
nil
{
fileReader
=
NewMultiFileReader
(
req
.
Files
(),
true
)
reader
=
fileReader
}
else
{
// if we have no file data, use an empty Reader
// (http.NewRequest panics when a nil Reader is used)
reader
=
strings
.
NewReader
(
""
)
}
path
:=
strings
.
Join
(
req
.
Path
(),
"/"
)
url
:=
fmt
.
Sprintf
(
ApiUrlFormat
,
c
.
serverAddress
,
ApiPath
,
path
,
query
)
httpReq
,
err
:=
http
.
NewRequest
(
"POST"
,
url
,
fileR
eader
)
httpReq
,
err
:=
http
.
NewRequest
(
"POST"
,
url
,
r
eader
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
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