Wrapping up headers and JSON content, to POST against Sendgrid's API, I noticed that it returns http0, while I was expecting to see a JSON result.
[09/Nov/2018:17:55:20][2622.7fa7b08ef700][-conn:evex:1:84-] Notice: http0
The source code is:
###
#set http [util::http::get -url $url] Bad call ad_proc deprecated
# is ad_proc util::http::post deprecated?
set content [export_vars $url]
set req_hdrs [ns_set create]
# headers necesary for a post and the form variables
ns_set put $req_hdrs Accept "*/*"
ns_set put $req_hdrs User-Agent "[ns_info name]-Tcl/[ns_info version]"
ns_set put $req_hdrs "Content-Type" "application/json"
ns_set put $req_hdrs "Content-Length" [string length $content]
ns_set put $req_hdrs "authorization" "Bearer XXXXX"
...
set body "
{"personalizations":[{"to":[{"email":"mailto:iuri.sampaio@gmail.com";,"name":"Iuri Sampaio"}],"subject":"Hello, World frmo Sendgrid!"}], "template_id":"d-0e5333876a1f4676b2dd16f2587e7380","content": [{"type"\
: "text/plain", "value": "Heya!"}],"from":{"email":"mailto:noreply@evex.co";,"name":"EvEx"},"reply_to":{"email":"mailto:noreply@evex.co";,"name":"EvEx Evento Exp
erience"}}
"
# POST Request
set http [ns_http run -method "POST" -headers $req_hdrs -body $body $url]
ns_log Notice "$http"
Best wishes,
I