Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
47a79141
Commit
47a79141
authored
Nov 18, 2015
by
vaikas-google
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #106 from bmelville/104
Pretty print JSON responses from service.
parents
ccdd32b3
82e7d088
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
dm.go
dm/dm.go
+7
-1
No files found.
dm/dm.go
View file @
47a79141
...
...
@@ -169,7 +169,13 @@ func main() {
func
callService
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
{
u
:=
fmt
.
Sprintf
(
"%s/%s"
,
*
service
,
path
)
fmt
.
Println
(
callHttp
(
u
,
method
,
action
,
reader
))
resp
:=
callHttp
(
u
,
method
,
action
,
reader
)
var
prettyJSON
bytes
.
Buffer
if
err
:=
json
.
Indent
(
&
prettyJSON
,
[]
byte
(
resp
),
""
,
" "
);
err
!=
nil
{
log
.
Fatalf
(
"Failed to parse JSON response from service: %s"
,
resp
)
}
fmt
.
Println
(
prettyJSON
.
String
())
}
func
callHttp
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
string
{
...
...
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