DE-1 | Fixed build issue

This commit is contained in:
Nirmit Jain
2024-03-06 18:34:04 +05:30
committed by GitHub
parent 1755fe4ae3
commit 7190b146e1

View File

@@ -10,6 +10,7 @@ import (
"io/ioutil"
"net/http"
"time"
"fmt"
)
var (
@@ -39,16 +40,6 @@ func eventsHandlerJson(w http.ResponseWriter, r *http.Request) {
headerName := "X-Correlation-Id"
substring := "abcdabcd-1234"
headerValue, ok := r.Header[headerName]
if ok {
if strings.HasPrefix(headerValue[0], substring) {
w.Header().Set("Content-Type", "application/json")
lib.JsonRequestChannel <- &lib.RequestObject{Body: body, Header: r.Header}
var rsp = CustomResponse{Code: 200, Message: "OK"}
json.NewEncoder(w).Encode(rsp)
log.Printf("Dropped blacklisted request")
return
}
}
var reader io.Reader
// check if body is gzip compressed
@@ -75,6 +66,17 @@ func eventsHandlerJson(w http.ResponseWriter, r *http.Request) {
return
}
if ok {
if strings.HasPrefix(headerValue[0], substring) {
w.Header().Set("Content-Type", "application/json")
lib.JsonRequestChannel <- &lib.RequestObject{Body: body, Header: r.Header}
var rsp = CustomResponse{Code: 200, Message: "OK"}
json.NewEncoder(w).Encode(rsp)
fmt.Println("Dropped blacklisted request")
return
}
}
w.Header().Set("Content-Type", "application/json")
lib.JsonRequestChannel <- &lib.RequestObject{Body: body, Header: r.Header}
var rsp = CustomResponse{Code: 200, Message: "OK"}