How to read post string in go via gin-gonic

PHPz
Release: 2024-02-09 21:27:21
forward
827 people have browsed it

如何通过 gin-gonic 读取 go 中的帖子字符串

In Go language, reading post string using gin-gonic framework is a common task. With gin-gonic we can easily handle HTTP requests and responses and extract the required data from them. This article will show you how to read post strings in Go using the gin-gonic framework. Let us follow the guidance of PHP editor Yuzai and explore this interesting and practical technique together!

Question content

This may be a stupid question, but I just can't get this from the documentation. please help

So, I want the client to send a POST request like this

curl -X POST localhost -d "haha"

This is not json or any encoding, but a simple string How do I read this via gin-gonic?

Thank you

Solution

This solves the problem

str, err := c.GetRawData()
Copy after login

The above is the detailed content of How to read post string in go via gin-gonic. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!