2017-04-26 13:30
浏览 674


I'm trying to pass a URL as a parameter in Golang, and I haven't been able to find a solution in all of the tutorials I've looked at. The problem is that I can only get the url to return minus a crucial forward slash.

My handler looks like this:

router.HandleFunc("/new/{url}", createURL)

So the request would look like:

However, the url that I results is missing a slash:


I sure it's probably got something to do with RFC3986, but is there a way to pass in the url as it is?

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

我正在尝试将URL作为参数传递给Golang,但我一直找不到 我看过的所有教程中的解决方案。 问题是我只能使网址返回减去关键的正斜杠。</ p>

我的处理程序如下:</ p>

  router  .HandleFunc(“ / new / {url}”,createURL)
 </ code> </ pre> 

因此请求看起来像:</ p>

 < 代码>
 </ code> </ pre> 

但是,我生成的网址缺少斜线: </ p>

 </ code> </ pre> 

我确定它可能与RFC3986有关, 但是有没有办法按原样传递URL?</ p> </ div>

2条回答 默认 最新

相关推荐 更多相似问题