dtslobe4694 2017-04-13 13:19
浏览 714
已采纳

Golang发送http请求发送两次而不是一次

I am trying to do simple http post request using the following code: Golang code from another SO post

It's sending the http request twice (I tried both to my own web service and also to the Firebase messaging server). Anyone have any idea of what's wrong? Thank you.

Edit Ignore me, figured out it's the AVG anti virus causing the problem. If I do:go run program.go then hit enter just once, AVG interrupts saying it has scan it and then let it run. This results in the http call twice. If I disable antivirus before running, then the http requrest is received only once on the other side. I've switched the antivirus on and off a few times to confirm this is the cause.

  • 写回答

1条回答 默认 最新

  • dongnaoxia0927 2017-04-14 14:11
    关注

    As in my edit, the cause was AVG anti virus. There was nothing in the console log indicating any part of the program was run twice. Not sure why the downvotes, I spend a few hours on this, move from Firebase messaging server to my own webserver to remove external dependency, and even read the source in net/http package.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?