duandu1966 2014-05-20 20:48
浏览 193
已采纳

使用Go根据RFC 1738编码URL字符串

I'm trying to send a request to Twitter through my Go application, and Twitter's API requires that you encode the consumer key and secret according to RFC 1738. Is there a Go function built to do this? From what I see in the net/url package, Go uses RFC 3986 by default, and I don't see any functions on http://golang.org/pkg/net/url/ that would allow me to convert to RFC 1738.

As a heads-up, I know that RFC 3986 is newer and obsoletes 1738, but the Twitter API asks specifically for RFC 1738 so I figured I should try to do that to avoid possibly getting screwed over by a corner case. For clarification, I'm talking about part 1 of the "Issuing application-only requests" section on this page: https://dev.twitter.com/docs/auth/application-only-auth

  • 写回答

1条回答 默认 最新

  • dougao9864 2014-05-21 10:35
    关注

    RFC 3986 updates RFC 1738. You can comply with RFC 1738 by complying with RFC 3986, and therefore achieve what Twitter expects.

    So the net/url package should fully meet your needs.

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

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?