TP-0000 | header file (#88)

This commit is contained in:
Abhijeet Gupta
2023-05-29 12:36:42 +05:30
committed by GitHub Enterprise
parent 57788c808f
commit cbbdb9aba1

View File

@@ -141,9 +141,17 @@ func (s *Server) severityHandler(houstonGroup *gin.RouterGroup) {
}
func (s *Server) incidentClientHandler(houstonGroup *gin.RouterGroup) {
houstonClient := NewHoustonClient(s.logger)
incidentHandler := service.NewIncidentService(s.gin, s.logger, s.db, houstonClient.socketModeClient)
// Add a header to the routes in houstonGroup
houstonGroup.Use(func(c *gin.Context) {
// Add your desired header key-value pair
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
c.Writer.Header().Set("Access-Control-Allow-Headers", viper.GetString("allowed.custom.headers"))
origin := c.Request.Header.Get("Origin")
c.Writer.Header().Set("Access-Control-Allow-Origin", origin)
})
//Will be deprecated because they are not using hosuton group
s.gin.POST("/create-incident", incidentHandler.CreateIncident)