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