dsmlf1207915 2016-04-25 11:54
浏览 454
已采纳

使Go http.Response详细说明所有参数

I am having a problem getting a parameter sent from android app into go application. I called r.FormValue(key) but it returned null. I want to find the way to check what are parameters available on Go side after the android app sent the post data to it. Is there any way to do this, getting all parameters without using keys?

  • 写回答

2条回答 默认 最新

  • dounuogong0358 2016-04-25 12:00
    关注

    The Request structure in go has a Form field which is populated with request parameters after ParseForm() is called.

    Form contains the parsed form data, including both the URL field's query parameters and the POST or PUT form data.This field is only available after ParseForm is called. The HTTP client ignores Form and uses Body instead.

    You could try adding the following code after receiving a request:

    func(w http.ResponseWriter, request *http.Request) {
        request.ParseForm()
        log.Printf("%v",request.Form)
    
        //....
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测