forked from Daniel.Sy/loic-go
Co-authored-by: Daniel Sy <Daniel.Sy@t-systems.com> Reviewed-on: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/Daniel.Sy/loic-go/pulls/4
This commit is contained in:
parent
e151b4a6e1
commit
483484e2e2
3 changed files with 16 additions and 4 deletions
|
|
@ -23,6 +23,10 @@ func Start() {
|
|||
})
|
||||
|
||||
r.POST("/start", func(c *gin.Context) {
|
||||
if c.Request.Method != http.MethodPost {
|
||||
http.Error(c.Writer, "Invalid request method", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
targetURL := c.PostForm("target_url")
|
||||
concurrency, _ := strconv.Atoi(c.PostForm("concurrency"))
|
||||
duration, _ := time.ParseDuration(c.PostForm("duration"))
|
||||
|
|
@ -33,6 +37,10 @@ func Start() {
|
|||
})
|
||||
|
||||
r.POST("/stop", func(c *gin.Context) {
|
||||
if c.Request.Method != http.MethodPost {
|
||||
http.Error(c.Writer, "Invalid request method", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
loic.StopTest()
|
||||
c.Redirect(http.StatusSeeOther, "/")
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue