Skip to content

More insight into the login handshaking #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
suntong opened this issue May 8, 2021 · 6 comments
Closed

More insight into the login handshaking #12

suntong opened this issue May 8, 2021 · 6 comments
Labels
future add todo list

Comments

@suntong
Copy link
Contributor

suntong commented May 8, 2021

Following up on #11,

Please add a debug option so that people can completely trace the login handshaking steps, logging to console what request is being sending over, and what the response and its headers are as well.

Thus when people experience problem similar to #11, by sending the detailed login handshaking trace, we can have a pretty good understanding of what's going on, and might be able to pinpoint the problem right away.

Pls consider. thx

@eatmoreapple
Copy link
Owner

您好,您的这个问题目前可以通过goland的debug功能来实现。我们也会将这个功能加入todo list

@eatmoreapple eatmoreapple added the future add todo list label May 10, 2021
@eatmoreapple
Copy link
Owner

package main

import (
	"fmt"
	"github.com/eatMoreApple/openwechat"
	"net/http"
)

type ResponseHooker struct{}

func (r ResponseHooker) BeforeRequest(req *http.Request) {}

func (r ResponseHooker) AfterRequest(response *http.Response, err error) {
	fmt.Println(response.Request.URL.Path)
	fmt.Println(response.Request.Header)
}

func main() {
	bot := openwechat.DefaultBot(openwechat.Desktop)
	bot.Caller.Client.AddHttpHook(ResponseHooker{})
}

目前您可以配合一些实用的日志库来实现类似的功能

@suntong
Copy link
Contributor Author

suntong commented May 23, 2021

Yep, that'll do. thx. I'll try today...

@suntong
Copy link
Contributor Author

suntong commented May 25, 2021

I tried it, but got:

bot.Caller.Client.AddHttpHook undefined (type *openwechat.Client has no field or method AddHttpHook)

@suntong
Copy link
Contributor Author

suntong commented May 25, 2021

目前您可以配合一些实用的日志库来实现类似的功能

Oh, I thought I should implement my own AfterRequest() function.
Or did you mean I should implement bot.Caller.Client.AddHttpHook instead?

@suntong
Copy link
Contributor Author

suntong commented Jul 7, 2021

I thought I should implement my own AfterRequest() function.

Problem still not solved.

Can you reopen pls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future add todo list
Projects
None yet
Development

No branches or pull requests

2 participants