Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
863414a1
Commit
863414a1
authored
Jan 29, 2020
by
Janos Guljas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return string duration by pingpong api endpoint
parent
7daf11d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
pingpong.go
pkg/api/pingpong.go
+2
-3
pingpong_test.go
pkg/api/pingpong_test.go
+1
-1
No files found.
pkg/api/pingpong.go
View file @
863414a1
...
...
@@ -7,7 +7,6 @@ package api
import
(
"errors"
"net/http"
"time"
"github.com/ethersphere/bee/pkg/jsonhttp"
"github.com/ethersphere/bee/pkg/p2p"
...
...
@@ -16,7 +15,7 @@ import (
)
type
pingpongResponse
struct
{
RTT
time
.
Duration
`json:"rtt"`
RTT
string
`json:"rtt"`
}
func
(
s
*
server
)
pingpongHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
...
...
@@ -46,6 +45,6 @@ func (s *server) pingpongHandler(w http.ResponseWriter, r *http.Request) {
s
.
Logger
.
Infof
(
"pingpong succeeded to peer %s"
,
peerID
)
jsonhttp
.
OK
(
w
,
pingpongResponse
{
RTT
:
rtt
,
RTT
:
rtt
.
String
()
,
})
}
pkg/api/pingpong_test.go
View file @
863414a1
...
...
@@ -43,7 +43,7 @@ func TestPingpong(t *testing.T) {
t
.
Run
(
"ok"
,
func
(
t
*
testing
.
T
)
{
jsonhttptest
.
ResponseDirect
(
t
,
client
,
http
.
MethodPost
,
"/pingpong/"
+
peerID
.
String
(),
nil
,
http
.
StatusOK
,
api
.
PingpongResponse
{
RTT
:
rtt
,
RTT
:
rtt
.
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