当前位置:网站首页>Go: Gin urlencoded format
Go: Gin urlencoded format
2022-07-23 15:23:00 【It workers】
Code :
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
router.POST("/form_post", func(c *gin.Context) {
message := c.PostForm("message")
nick := c.DefaultPostForm("nick", "anonymous")
c.JSON(200, gin.H{
"status": "posted",
"message": message,
"nick": nick,
})
})
router.Run(":8080")
}
Run the program
Client side test
->curl localhost:8080/form_post --form message=hello
{"message":"hello","nick":"anonymous","status":"posted"}Server log
边栏推荐
猜你喜欢

深入理解L1、L2正则化

他山之石 | 阿里多模态知识图谱探索与实践

MariaDB 数据库升级版本

多项式承诺Polynomial commitment方案汇总

turbo编译码误码率性能matlab仿真

在一个有序数组中查找具体的某个数字(二分查找or折半查找)

Cloud native observability tracking technology in the eyes of Baidu engineers

Leetcode: 17. letter combination of phone number

易基因|靶基因DNA甲基化测序(Target-BS)

The current situation and history of it migrant workers
随机推荐
Redis bloom filter
第三篇 RBAC权限管理 数据库设计详解
pytorch opencv pil图像预处理比较
BGP联邦实验
xlswriter - excel导出
Time series data in industrial Internet of things
修改ssh命令行[[email protected]]#颜色
Linked list review!
BGP federal experiment
Simulink simulation of ESP three-phase SVPWM controller
Use of RSA encryption
ESP三相SVPWM控制器的simulink仿真
动态规划-力扣
AVX指令集加速矩阵乘法
Clickhouse, let the query fly!!!
VSCode 更新后与tab相关快捷键无法使用
What is the difference between server hosting and virtual host
Monotonous stack!!!
Part II how to design an RBAC authority system
Error | cannot read property '_ normalized‘ of undefined