2017-04-13 13:19
浏览 444


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.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用以下代码进行简单的http发布请求: 来自另一个SO帖子的Golang代码

它发送了两次HTTP请求(我尝试了自己的Web服务, 到Firebase邮件服务器)。 任何人都知道怎么了吗? 谢谢。

编辑 请忽略我,发现它是导致问题的AVG防病毒软件。 如果执行以下操作: go run program.go ,然后仅按Enter键一次,AVG会打断它已对其进行扫描然后再运行。 这将导致http调用两次。 如果我在运行前禁用了防病毒软件,则在另一侧仅收到一次http requrest。 我已打开和关闭防病毒软件几次,以确认这是原因。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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.

    点赞 打赏 评论

相关推荐 更多相似问题