dounou9751 2017-06-29 07:28
浏览 76
已采纳

当通配符参数中出现双斜杠时,为什么大猩猩复用器会重定向?

Here my handler :

router.HandleFunc("/g/{gparam:.*}", MyHandler)

Bu when i pass something like "123://abc" as param it redirect and modify the param in url to "123:/abc".

is their a way to avoid that ?

  • 写回答

2条回答 默认 最新

  • dongyiba8082 2017-06-29 08:57
    关注

    It's intended behavior, and is configurable. By default, Gorilla mux will do path cleaning, i.e. removing double slash etc. for new router. You can left the double slash as is by:

    router.SkipClean(true)
    

    The SkipClean documentation says:

    ...
    When true, if the route path is "/path//to", it will remain with the double slash. This is helpful if you have a route like: /fetch/http://xkcd.com/534/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 求fpga交通信号灯设计Verilog代码
  • ¥50 adb连接不到手机是怎么回事?
  • ¥20 抓取数据时发生错误: get_mooncake_data() missing 1 required positional argument: 'driver'的问题,怎么改出正确的爬虫代码?
  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头
  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人