I'm running my API backend in Go on App Engine

When a user creates an account, he gets sent an activation email.

The normal tutorial for this doesn't work since App engine refuses the 
default http client and I have the urlfetch one

I've been trying to figure this out for hours but can't seem to get it right

My code right now 

        requestHeaders := make(map[string]string)
requestHeaders["Authorization"] = "Bearer api_key"
requestHeaders["User-Agent"] = "sendgrid/3.1.0o"
requestHeaders["Accept"] = "application/json"

request := Request{
Method : "POST",
BaseURL : "https://api.sendgrid/com/v3/mail/send";,
Headers : requestHeaders,

}
request.Body = []byte(` {
    "personalizations": [
       {
           "to": [
               {
                   "email": "`+user_email+`"
               }
           ],
           "substitutions" : {
            "-username-" : "`+username+`",
            "-code-" : "`+user_code+`",
            "-email-" : "`+user_email+`"
           }            
       }
   ],
   "from": {
       "email": "noreply@"
   },
   "template_id" : "f69ce275-2421-4fca-beb0-247482ea3af0"
}`)

customClient := urlfetch.Client(appengine.NewContext(r))
response,err := customClient.Do(request)

Which gives me "Cannot use request (type Request) as type *http.Request in 
argument to customClient.Do

Where do I add in the bit that makes the call use the urlfetch instead of 
the default http client?

Many thanks




-- 
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