From: Iuri S. <iu...@iu...> - 2019-11-15 15:40:46
|
What would be the argument/switch to convert the option -u, from CURL command, to ns_http command? curl -v https://myhost.com/oauth2/token <https://myhost.com/oauth2/token> \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "client_id:secret" \ -d "grant_type=client_credentials" Reading ns_http documentation I was not able to figure that out. https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html#section3 <https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html#section3> set url "https://myhost.com/v1/oauth2/token <https://myhost.com/v1/oauth2/token>" set requestHeaders [ns_set create] set replyHeaders [ns_set create] ns_set update $requestHeaders "Content-Type" "application/json" ns_set update $requestHeaders "Accept" "application/json" ns_set update $requestHeaders "Accept-Language" "en_US" set data "grant_type=client_credentials" set result [ns_http queue -method POST \ -headers $requestHeaders \ -timeout 10.0 \ -body $data \ $url] ns_http wait -result R -headers $replyHeaders -status S $result Best wishes, I |