Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
More go import reorderings
· 1636e08d
Justin Kromlinger
authored
Oct 30, 2019
1636e08d
Update unit tests
· a1b35852
Justin Kromlinger
authored
Oct 30, 2019
a1b35852
Hide whitespace changes
Inline
Side-by-side
server/handlerIndex.go
View file @
a1b35852
package
server
import
(
"github.com/gin-gonic/gin"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
func
(
s
Server
)
handlerIndex
(
c
*
gin
.
Context
)
{
...
...
server/security.go
View file @
a1b35852
...
...
@@ -2,10 +2,11 @@ package server
import
(
"fmt"
"github.com/gin-gonic/gin"
"github.com/unrolled/secure"
"net/http"
"strings"
"github.com/gin-gonic/gin"
"github.com/unrolled/secure"
)
func
(
s
Server
)
getSecureMiddleware
()
*
secure
.
Secure
{
...
...
server/server_test.go
View file @
a1b35852
...
...
@@ -2,14 +2,15 @@ package server
import
(
"fmt"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"net"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
var
influxAddressLoadData
,
...
...
@@ -290,9 +291,9 @@ func (s *Server) headerTest(t *testing.T) {
s
.
Router
.
ServeHTTP
(
w
,
req
)
assert
.
Equal
(
t
,
200
,
w
.
Code
)
assert
.
True
(
t
,
strings
.
Contains
(
w
.
Body
.
String
(),
fmt
.
Sprintf
(
`<style rel=
"
stylesheet
"
type="text/css">%s</style>`
,
s
.
css
)))
assert
.
True
(
t
,
strings
.
Contains
(
w
.
Body
.
String
(),
fmt
.
Sprintf
(
`<style rel=stylesheet type="text/css">%s</style>`
,
s
.
css
)))
if
path
==
"/status"
{
assert
.
True
(
t
,
strings
.
Contains
(
w
.
Body
.
String
(),
`<link rel=
"
stylesheet
"
type="text/css" href="/css/status.css">`
))
assert
.
True
(
t
,
strings
.
Contains
(
w
.
Body
.
String
(),
`<link rel=stylesheet type="text/css" href="/css/status.css">`
))
}
}
}
...
...
@@ -552,7 +553,7 @@ func TestNoDebugCSS(t *testing.T) {
assert
.
Equal
(
t
,
http
.
StatusOK
,
w
.
Code
)
assert
.
Contains
(
t
,
w
.
Body
.
String
(),
"mail@hashworks.net"
)
assert
.
True
(
t
,
strings
.
Contains
(
w
.
Body
.
String
(),
fmt
.
Sprintf
(
"<style rel=
\"
stylesheet
\"
type=
\"
text/css
\"
>%s</style>"
,
s
.
css
)))
assert
.
True
(
t
,
strings
.
Contains
(
w
.
Body
.
String
(),
fmt
.
Sprintf
(
"<style rel=stylesheet type=
\"
text/css
\"
>%s</style>"
,
s
.
css
)))
}
func
TestConfigError
(
t
*
testing
.
T
)
{
...
...
server/specialHandlers.go
View file @
a1b35852
package
server
import
(
"github.com/gin-contrib/cache"
"github.com/gin-contrib/cache/persistence"
"github.com/gin-gonic/gin"
"log"
"net/http"
"strings"
"time"
"github.com/gin-contrib/cache"
"github.com/gin-contrib/cache/persistence"
"github.com/gin-gonic/gin"
)
func
(
s
Server
)
recoveryHandlerStatus
(
statusCode
int
,
c
*
gin
.
Context
,
err
interface
{})
{
...
...