当前位置:网站首页>go : gin Urlencoded 格式
go : gin Urlencoded 格式
2022-07-23 10:20:00 【IT工作者】
代码:
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")
}
运行程序
客户端测试
->curl localhost:8080/form_post --form message=hello
{"message":"hello","nick":"anonymous","status":"posted"}服务端日志
边栏推荐
- Mathematical function of MySQL function summary
- dataframe.groupby学习资料
- 安全7.18作业
- Common SQL of Oracle Report
- 21 - vertical traversal of binary tree
- 基于PSO优化的多目标最优值求解matlab仿真
- 读写锁ReadWriteLock还是不够快?再试试S…
- 用FFT加速特殊矩阵的矩阵向量乘运算
- The problem of double type precision loss and its solution
- Matlab simulation of solving multi-objective optimal value based on PSO optimization
猜你喜欢

Matlab simulation of solving multi-objective optimal value based on PSO optimization

Building personal network disk based on nextcloud

Multiple backpacks!

@FeignClient使用详细教程(图解)

Start process of activity

Simulink simulation of ESP three-phase SVPWM controller

Cmake notes

C thread lock and single multithreading are simple to use

基於matlab的CBOC信號調制解調仿真,輸出其相關性,功率譜以及頻偏跟踪

精品国创《少年歌行》数字藏品开售,邀你共铸少年武侠江湖梦
随机推荐
基于双目相机拍摄图像的深度信息提取和目标测距matlab仿真
什么是服务器托管及和虚拟主机的区别
一道代码题看 CommonJS 模块化规范
头部姿态估计原理及可视化_loveliuzz的博客-程序员宅基地_头部姿态估计
解决kotlin写Android项目编译报Execution failed for task ‘:app:kaptDebugKotlin‘.异常
【无标题】
Multiple backpacks!
152. Product maximum subarray
[untitled]
深度学习单图三维人脸重建
[untitled]
Axure进阶
turbo编译码误码率性能matlab仿真
Unreal中通过FMonitoredProcess启动其他独立程序
NVIDIA vid2vid paper reproduction
[software testing] how to sort out your testing business
Liunx:浅析vim编辑器基本使用
Blazor quickly realizes Minesweeper
day18
[转]基于POI的功能区划分()