Skip to content

Commit

Permalink
debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
nikotung committed Nov 16, 2022
1 parent c52407a commit 5f3889b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion boox.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,5 +480,14 @@ func request(r *http.Request, t string) (*http.Response, error) {
r.Header.Set("Authorization", "Bearer "+t)
}

return http.DefaultClient.Do(r)
resp, err := http.DefaultClient.Do(r)

if bot.Debug {
rqb, _ := io.ReadAll(r.Body)
rsb, _ := io.ReadAll(resp.Body)

log.Printf("Endpoint: %s, request: %s,response:%s", r.URL, string(rqb), string(rsb))
}

return resp, err
}
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func main() {

func handleUpdate(update tgbotapi.Update) {

if update.Message == nil {
return
}

if update.Message.IsCommand() {
HandleCommand(update.Message)
}
Expand Down

0 comments on commit 5f3889b

Please sign in to comment.