Livecode equivalent to "curl -vX POST"
Posted: Sun Apr 03, 2016 2:24 am
I am trying to get a cookie from CouchDB for authentication.
here's what I use from the command line:
and this is what I should get:
When I post the data in livecode I only get the JSON at the end...
yields:
so it's like Livecode uses the equivalent of "curl -X POST" but I need "curl -vX POST", it's the verbose part (-v) that contains the session information I need for the cookie...
here's what I use from the command line:
Code: Select all
curl -vX POST "http://couch.mad.pink/_session" /
-H 'Content-Type:application/x-www-form-urlencoded' /
-d "name=fmulder&password=trustno1"
Code: Select all
< HTTP/1.1 200 OK
< Date: Sun, 03 Apr 2016 00:29:28 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 43
< Connection: keep-alive
< Set-Cookie: AuthSession=YWRtaW46NTcwMDYzRTg60vGcP_HfLFPktSgD42CD3NpIbrg; Version=1; Path=/; HttpOnly
< Cache-Control: must-revalidate
< X-Resolver-IP: 38.72.99.162
{"ok":true,"name":"FoxM","roles":["_admin"]}
Code: Select all
put "Accept: application/json, text/plain, text/event-stream"&cr into couchHeaders
put "Content-Type:application/x-www-form-urlencoded" after couchHeaders
set httpheaders to couchHeaders
post "name=fmulder&password=trustno1" to URL "http://couch.mad.pink/_session"
put the urlResponse into field "outPut"
Code: Select all
{"ok":true,"name":"FoxM","roles":["_admin"]}