当前位置:网站首页>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
边栏推荐
猜你喜欢

麒麟V10源码编译qtCreator4.0.3记录

Subsequence --- edit distance

ESP三相SVPWM控制器的simulink仿真

深入理解L1、L2正则化

Simulation of voltage source PWM rectifier with double closed loop vector control based on Simulink

Matlab simulation of Turbo code error rate performance

Time series data in industrial Internet of things

Axure进阶

安全合理用电 收获清凉一“夏”

基于双目相机拍摄图像的深度信息提取和目标测距matlab仿真
随机推荐
Selenium in the crawler realizes automatic collection of CSDN bloggers' articles
基于simulink的双闭环矢量控制的电压型PWM整流器仿真
pytorch opencv pil图像预处理比较
MariaDB 数据库升级版本
信号量
【Pygame实战】飞机射击大作:宇宙激战一触即发...这款超经典的射击游戏也该拿出来重启了~
Matlab simulation of solving multi-objective optimal value based on PSO optimization
【启发式分治】启发式合并的逆思想
什么是服务器托管及和虚拟主机的区别
OPNsense – 多功能高可靠易使用的防火墙(二)
STL deque
String与Integer互相转换
[solve the exception] Flink uploads the jar package to the cluster environment, and the operation report does not serialize the exception
广州举办镇街农产品质量安全监管员大比武
Les raccourcis clavier liés à l'onglet ne peuvent pas être utilisés après la mise à jour du vscode
581. Shortest unordered continuous subarray
PostgreSQL has no NVL solution. PostgreSQL queries all tables
数据治理浅析
Part III detailed explanation of RBAC authority management database design
it 农民工的现状和历史