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 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python