I'm fairly new to learning golang, but I hope someone can help...
I'm trying to replicate a process I can do using curl
. Essentially I need to create a PUT request, using form data and the contents of a file.
The `curl request looks like this:
curl -s -X PUT \
-H 'Authorization: Bearer MDIzNzMzOTQ2NjamOkye60eSXl2DhkYwO1K/YAFV192' \
'https://bitbucket.example.com/rest/api/1.0/projects/MY-PROJECT/repos/code-repo/browse/dev/src/text_file' \
-F 'content=@/tmp/temp_file' \
-F 'branch=feature/new-thing' \
-F 'message=Some Awesome Commit' \
-F 'sourceCommitId=12d8db33f539b60dded039102526e996f3963250'
I'm really struggling with the New'Request
piece.
I need to use New.Request
, as I have a custom auth Header which I need to use.
But I'm struggling to understand how I get my form data and the file contents into the PUT request.
Any advice would be greatly appreciated.