summaryrefslogtreecommitdiff
path: root/internal/server
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-02-16 16:03:46 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2023-02-16 16:03:46 +0100
commit57705feadd598c9a14df53b83161b8f020731bd6 (patch)
tree0320e7739eca0c0afbe7087340d017413940c31e /internal/server
parent0566c505b1462e47a9dc44d7b26534b41aca1c4f (diff)
Format: Run gofumpt
Diffstat (limited to 'internal/server')
-rw-r--r--internal/server/api_test.go28
-rw-r--r--internal/server/base.go1
-rw-r--r--internal/server/server.go2
3 files changed, 15 insertions, 16 deletions
diff --git a/internal/server/api_test.go b/internal/server/api_test.go
index 00fba3d..b1e3550 100644
--- a/internal/server/api_test.go
+++ b/internal/server/api_test.go
@@ -10,7 +10,6 @@ import (
"github.com/go-errors/errors"
)
-
func getErrorMsg(err error) string {
if err == nil {
return ""
@@ -44,49 +43,49 @@ func Test_APIGetEndpoints(t *testing.T) {
}{
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://example.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: nil,
},
{
epl: EndpointList{
- API: "http://example.com/1",
+ API: "http://example.com/1",
Authorization: "https://example.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: errors.New("API scheme: 'http', is not equal to authorization scheme: 'https'"),
},
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://example.com/2",
- Token: "ftp://example.com/3",
+ Token: "ftp://example.com/3",
},
err: errors.New("API scheme: 'https', is not equal to token scheme: 'ftp'"),
},
{
epl: EndpointList{
- API: "https://malicious.com/1",
+ API: "https://malicious.com/1",
Authorization: "https://example.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: errors.New("API host: 'malicious.com', is not equal to authorization host: 'example.com'"),
},
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://example.com/2",
- Token: "https://malicious.com/3",
+ Token: "https://malicious.com/3",
},
err: errors.New("API host: 'example.com', is not equal to token host: 'malicious.com'"),
},
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://malicious.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: errors.New("API host: 'example.com', is not equal to authorization host: 'malicious.com'"),
},
@@ -99,7 +98,7 @@ func Test_APIGetEndpoints(t *testing.T) {
},
}
// Update the handler
- hs.SetHandler(http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
+ hs.SetHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
jsonStr, err := json.Marshal(ep)
@@ -108,7 +107,6 @@ func Test_APIGetEndpoints(t *testing.T) {
}
fmt.Fprintln(w, string(jsonStr))
-
}))
gotEP, err := APIGetEndpoints(s.URL, c)
if getErrorMsg(err) != getErrorMsg(tc.err) {
diff --git a/internal/server/base.go b/internal/server/base.go
index 87bb488..bfa0d73 100644
--- a/internal/server/base.go
+++ b/internal/server/base.go
@@ -2,6 +2,7 @@ package server
import (
"time"
+
"github.com/eduvpn/eduvpn-common/internal/http"
)
diff --git a/internal/server/server.go b/internal/server/server.go
index c68916e..ef02612 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -41,7 +41,7 @@ type EndpointsVersions struct {
// Endpoints defines the json format for /.well-known/vpn-user-portal".
type Endpoints struct {
API EndpointsVersions `json:"api"`
- V string `json:"v"`
+ V string `json:"v"`
}
// ShouldRenewButton returns whether or not the renew button should be shown for the server