DE-1 | Update handlers.go
This commit is contained in:
@@ -35,6 +35,21 @@ type CustomResponse struct {
|
||||
|
||||
func eventsHandlerJson(w http.ResponseWriter, r *http.Request) {
|
||||
eventHandlerStartTime := utils.NanosToMillis(time.Now().UnixNano())
|
||||
|
||||
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
|
||||
if r.Header.Get("Content-Encoding") == "gzip" {
|
||||
|
||||
Reference in New Issue
Block a user