.
This commit is contained in:
parent
57af3812c0
commit
ff877cc987
@ -292,7 +292,7 @@ func main() {
|
|||||||
|
|
||||||
connectToRabbitMQ()
|
connectToRabbitMQ()
|
||||||
|
|
||||||
http.HandleFunc("POST /test", func(res http.ResponseWriter, req *http.Request) {
|
http.HandleFunc("POST /rabbitmq-forwarder", func(res http.ResponseWriter, req *http.Request) {
|
||||||
if len(req.Header.Get("Content-Type")) == 0 ||
|
if len(req.Header.Get("Content-Type")) == 0 ||
|
||||||
req.Header["Content-Type"][0] != "application/json" ||
|
req.Header["Content-Type"][0] != "application/json" ||
|
||||||
req.Method != "POST" {
|
req.Method != "POST" {
|
||||||
@ -337,31 +337,29 @@ func main() {
|
|||||||
if DebugMode {
|
if DebugMode {
|
||||||
dumpUnhandledData(reqType, data)
|
dumpUnhandledData(reqType, data)
|
||||||
}
|
}
|
||||||
// return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// err = PublishMessage(repo.Owner.Username, reqType, data)
|
if org == nil {
|
||||||
// write to file for review
|
res.WriteHeader(http.StatusBadRequest)
|
||||||
id++
|
log.Printf("no `org` for message... type: %s", reqType)
|
||||||
os.WriteFile("test_data."+fmt.Sprint(id), data, 0644)
|
if DebugMode {
|
||||||
if org != nil {
|
dumpUnhandledData(reqType, data)
|
||||||
log.Println(id, org.Username, reqType, extraAction)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
err = PublishActionMessage(org.Username, reqType, extraAction, data)
|
||||||
err = PublishMessage(org.Name, reqType, extraAction, data)
|
if err != nil {
|
||||||
if err != nil {
|
errorStr := fmt.Sprintf("hook (%s) processing error: %v\n", reqType, err)
|
||||||
errorStr := fmt.Sprintf("hook (%s) processing error: %v\n", reqType, err)
|
res.Header().Add("Content-Type", "plain/text")
|
||||||
res.Header().Add("Content-Type", "plain/text")
|
res.Write([]byte(errorStr))
|
||||||
res.Write([]byte(errorStr))
|
res.WriteHeader(http.StatusBadRequest)
|
||||||
res.WriteHeader(http.StatusBadRequest)
|
|
||||||
|
|
||||||
if DebugMode {
|
if DebugMode {
|
||||||
log.Println(errorStr)
|
log.Println(errorStr)
|
||||||
}
|
}
|
||||||
} else {*/
|
}
|
||||||
res.WriteHeader(http.StatusOK)
|
res.WriteHeader(http.StatusOK)
|
||||||
// }
|
|
||||||
})
|
})
|
||||||
|
|
||||||
http.HandleFunc("POST /rabbitmq-forwarder/{Org}", func(res http.ResponseWriter, req *http.Request) {
|
http.HandleFunc("POST /rabbitmq-forwarder/{Org}", func(res http.ResponseWriter, req *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user