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
e5e121a6
Commit
e5e121a6
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Made Request#Option also return an existence bool
parent
4f06c6fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
commands/request.go
commands/request.go
+3
-2
commands/response.go
commands/response.go
+2
-2
No files found.
commands/request.go
View file @
e5e121a6
...
...
@@ -21,8 +21,9 @@ func (r *Request) SetPath(path []string) {
r
.
path
=
path
}
func
(
r
*
Request
)
Option
(
name
string
)
interface
{}
{
return
r
.
options
[
name
]
func
(
r
*
Request
)
Option
(
name
string
)
(
interface
{},
bool
)
{
val
,
ok
:=
r
.
options
[
name
]
return
val
,
ok
}
func
(
r
*
Request
)
SetOption
(
name
string
,
value
interface
{})
{
...
...
This diff is collapsed.
Click to expand it.
commands/response.go
View file @
e5e121a6
...
...
@@ -57,8 +57,8 @@ func (r *Response) Marshal() ([]byte, error) {
return
nil
,
fmt
.
Errorf
(
"No error or value set, there is nothing to marshal"
)
}
enc
:=
r
.
req
.
Option
(
"enc"
)
if
enc
==
nil
{
enc
,
ok
:=
r
.
req
.
Option
(
"enc"
)
if
!
ok
||
enc
.
(
string
)
==
""
{
return
nil
,
fmt
.
Errorf
(
"No encoding type was specified"
)
}
encType
:=
EncodingType
(
strings
.
ToLower
(
enc
.
(
string
)))
...
...
This diff is collapsed.
Click to expand it.
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