mirror of
https://github.com/idanoo/go-mastodon-matrix-webhooks.git
synced 2024-11-24 01:15:18 +00:00
Remove duplicate handling
This commit is contained in:
parent
263bcf9250
commit
8f012fc275
14
main.go
14
main.go
@ -2,8 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -51,19 +49,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handler(w http.ResponseWriter, r *http.Request) {
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
var bodyBytes []byte
|
|
||||||
var err error
|
|
||||||
|
|
||||||
if r.Body != nil {
|
if r.Body != nil {
|
||||||
bodyBytes, err = io.ReadAll(r.Body)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Body reading error: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer r.Body.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(bodyBytes) > 0 {
|
|
||||||
var i IdentifyingRequest
|
var i IdentifyingRequest
|
||||||
err := json.NewDecoder(r.Body).Decode(&i)
|
err := json.NewDecoder(r.Body).Decode(&i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user