...
1 package device
2
3 import (
4 "fmt"
5 "net/http"
6
7 "github.com/gin-gonic/gin"
8 )
9
10 func (am *AuthMethod) setDisrupt(c *gin.Context) error {
11 if c.Request.Method == http.MethodPost {
12 am.service.disrupt = true
13 } else if c.Request.Method == http.MethodDelete {
14 am.service.disrupt = false
15 } else if c.Request.Method == http.MethodPut {
16 am.service.disrupt = !am.service.disrupt
17 }
18 fmt.Fprintf(c.Writer, "{disrupt:%t}", am.service.disrupt)
19 return nil
20 }
21
View as plain text