0

How to read from ctx.PostBody() key and value? I am using fasthttp package instead of http/net and posting from Postman the value of url

postmans result

fmt.Fprintln(ctx, string(ctx.PostBody()))
var link = ctx.PostBody()
rawBodyAsString := string(link)
println(rawBodyAsString)

I've got the string from PostBody.

the string:

----------------------------533411238113939951452693

Content-Disposition: form-data; name="url"

https://youtube.com

----------------------------533411238113939951452693--

How can I get the value only, without all these descriptions. I need the url from PostBody.


In case someone will need the solution to this:

It's FormValue syntax. Instead of PostBody. But, I'll try to use Raw tab in Postman and json syntax to unmarshall it.

0 Answers0