dongye9182 2017-02-14 09:25
浏览 19
已采纳

如何在Golang中解密POST请求主体

I am getting my request body value in encrypted form as below:

9oF0LS0aY0RGGfUEGoT%2FHSdqypxXKh7lmaTawlekrxw%3D

But the actual value I send is:

9oF0LS0aY0RGGfUEGoT/HSdqypxXKh7lmaTawlekrxw=

Any suggestion How I can get correct value.

  • 写回答

1条回答 默认 最新

  • dongxian1921 2017-02-14 09:43
    关注

    Your text has been url encoded. Probably because it was a query parameter ?

    What you can do is use the url.QueryUnescape function to decode the value.

    str := "9oF0LS0aY0RGGfUEGoT%2FHSdqypxXKh7lmaTawlekrxw%3D"
    str, _ = url.QueryUnescape(str)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?