当前位置:网站首页>【Golang】golang实现post请求发送form类型数据函数
【Golang】golang实现post请求发送form类型数据函数
2022-07-24 11:05:00 【陶士涵】
golang实现post请求发送form类型数据函数
//发送http post请求数据为form
func PostForm(url string, data url.Values) (string, error) {
resp, err := http.PostForm(url, data)
if err != nil {
return "", err
}
defer resp.Body.Close()
content, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(content), nil
}使用方式如下:
data := url.Values{}
data.Set("phone", phone)
data.Set("password", password)
data.Set("host", host)
res, err := PostForm("/xxxxxxx", data)边栏推荐
- 性能测试总结(一)---基础理论篇
- Summary of const type data
- Disk storage chain B-tree and b+ tree
- Read the triode easily. It turns out that it works like this
- The bean injected through @autowired can still be injected even if the class is not annotated with annotations such as @comment
- 神器 ffmpeg —— 操作视频,极度舒适
- Mockito3.8 how to mock static methods (how to mock PageHelper)
- MySQL根据备注查询表、字段
- View the source code of idea Download
- About [software testing - interview skills and precautions for automated testing] - talk freely
猜你喜欢
![[FPGA]: IP core --divider (divider)](/img/bc/d8b7638e236c468ba23c8afc7ab70e.png)
[FPGA]: IP core --divider (divider)

蓝牙模块的5大应用场景
![[FPGA]: IP core ibert](/img/f9/ef4c8d44be2e27b6d85010ca8cdefa.png)
[FPGA]: IP core ibert

Zero basis learning canoe panel (5) -- change the value of the variable, and the control image also changes. What's going on?

「低功耗蓝牙模块」主从一体 蓝牙嗅探-助力智能门锁
![[FPGA]: use of MicroBlaze](/img/f4/5114bf4bde10adaa22c7441350575c.png)
[FPGA]: use of MicroBlaze

零基础学习CANoe Panel(7)—— 文件选择(PathDiaglog)
![About [software testing - interview skills and precautions for automated testing] - talk freely](/img/c2/bd1a52bdd7ab07878348b6216012f0.png)
About [software testing - interview skills and precautions for automated testing] - talk freely

Neo4j installation tutorial

Capture and handling of JDBC exception sqlexception
随机推荐
简单理解modbus功能码和分区
Download path of twincat3 versions
rs485通信OSI模型网络层
Capture and handling of JDBC exception sqlexception
Cookie sessionstorage localstorage differences
Publish local images to Alibaba cloud
JMeter interface test steps - Installation Tutorial - script recording - concurrent test
BBR 与 queuing
【白帽子讲Web安全】第二章 浏览器安全
[FPGA]: IP core -- rapid IO
Development and course of Bluetooth Technology
MySQL查询字段匹配某个规则的记录
The solution of permission denied
Detailed explanation of Flink operation architecture
In idea, system.getproperty ("user.dir") identifies the path of the module: the setting of the working directory
STM32+ESP8266+MQTT协议连接阿里云物联网平台
MySQL engine
聊聊软件测试-自动化测试框架
2018 arXiv | Objective-Reinforced Generative Adversarial Networks (ORGAN) for Sequence Generation Mo
MySQL根据备注查询表、字段