I have the payload,
"--------------------------3c1e04950334427b
Content-Disposition: form-data; name="certificate"; filename="new-cert.pem"
Content-Type: application/octet-stream

-----BEGIN RSA PRIVATE KEY-----
<MY PRIVATE KEY>
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
<MY CERTIFICATE>
-----END CERTIFICATE-----

--------------------------3c1e04950334427b
Content-Disposition: form-data; name="body"
Content-Type: application/json

{"name":"test"}
--------------------------3c1e04950334427b--" which I obtained by doing,

//Here r is a *http.Request. object

body := new(bytes.Buffer)
if r.Body != nil {
       b, _ := ioutil.ReadAll(r.Body)
       r.Body = ioutil.NopCloser(bytes.NewBuffer(b))
       if len(b) > 0 {
              if err := json.Compact(body, b); err != nil {
                     body = bytes.NewBuffer(b)
              }
       }
}

payload := body.String()


I want to reconstruct the request from this payload, how can I do that ? Is 
that possible ? If yes, how ?


-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to