post method in golang?

78 views
Skip to first unread message

Victor L

unread,
Jul 28, 2016, 11:02:00 AM7/28/16
to golan...@googlegroups.com
I am using curl for REST call from json file, like the following:
curl  -X POST -H "Content-Type: application/json" http://127.0.0.1:8080/v2/apps?force=true -...@deploy.json
How can I translate this to "golang"  POST method? More specifically, how can i create request object from json file?
Thanks

Adrian Lanzafame

unread,
Jul 28, 2016, 11:47:36 PM7/28/16
to Victor L, golan...@googlegroups.com

Hi Victor,

Have you had a look at the net/http package? http://golang.org/pkg/net/http


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Adrian Lanzafame
Software Developer

m: 0435419266

Chris Broadfoot

unread,
Jul 29, 2016, 12:01:49 AM7/29/16
to Adrian Lanzafame, golang-nuts, Victor L

Try this awesome utility:
https://mholt.github.io/curl-to-go/

Reply all
Reply to author
Forward
0 new messages