-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock_session_service.go
49 lines (44 loc) · 1.12 KB
/
mock_session_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package infa_auth
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"log"
)
func mockServer() {
app := fiber.New()
app.Use(cors.New())
log.Println("starting server")
api := app.Group("/session-service/api/v1/session")
// Test handler
api.Get("/Agent", func(c *fiber.Ctx) error {
headers := c.GetReqHeaders()
log.Println(headers)
if headers == nil {
log.Println("no header")
}
var h string
h = headers["Ids-Agent-Session-Id"]
if h == "" {
log.Println("Ids-Agent-Session-Id header is null")
h = headers["IDS-AGENT-SESSION-ID"]
if h == "" {
log.Println("IDS-AGENT-SESSION-ID header is null")
h = headers["ids-agent-session-id"]
if h == "" {
log.Println("ids-agent-session-id header is null")
}
}
}
log.Println("value of header = " + h)
if "123123123" == h {
log.Println("SUCCESS")
return c.SendStatus(200)
} else {
log.Println("FAIL")
return c.SendStatus(203)
}
})
app.ListenTLS(":9898", "c:/tmp/certstrap-master/out/localhost.crt", "c:/tmp/certstrap-master/out/localhost.key")
//app.Listen(":9898")
log.Println("started")
}