1
0
Fork 0

see last commit

This commit is contained in:
Thomas Richter 2013-05-08 15:44:36 +02:00
parent 760a2e0778
commit f8a3b5947f
1 changed files with 13 additions and 9 deletions

View File

@ -165,6 +165,7 @@
return function (method, url, body, headers) { return function (method, url, body, headers) {
var response; var response;
var curl; var curl;
var i;
if (typeof body !== 'string') { if (typeof body !== 'string') {
body = JSON.stringify(body); body = JSON.stringify(body);
@ -173,35 +174,38 @@
curl = "unix> curl "; curl = "unix> curl ";
if (method === 'POST') { if (method === 'POST') {
response = internal.arango.POST_RAW(url, body); response = internal.arango.POST_RAW(url, body, headers);
curl += "-X " + method + " "; curl += "-X " + method + " ";
} }
else if (method === 'PUT') { else if (method === 'PUT') {
response = internal.arango.PUT_RAW(url, body); response = internal.arango.PUT_RAW(url, body, headers);
curl += "-X " + method + " "; curl += "-X " + method + " ";
} }
else if (method === 'GET') { else if (method === 'GET') {
response = internal.arango.GET_RAW(url, body); response = internal.arango.GET_RAW(url, headers);
} }
else if (method === 'DELETE') { else if (method === 'DELETE') {
response = internal.arango.DELETE_RAW(url, body); response = internal.arango.DELETE_RAW(url, headers);
curl += "-X " + method + " "; curl += "-X " + method + " ";
} }
else if (method === 'PATCH') { else if (method === 'PATCH') {
response = internal.arango.PATCH_RAW(url, body); response = internal.arango.PATCH_RAW(url, body, headers);
curl += "-X " + method + " "; curl += "-X " + method + " ";
} }
else if (method === 'HEAD') { else if (method === 'HEAD') {
response = internal.arango.HEAD_RAW(url, body); response = internal.arango.HEAD_RAW(url, headers);
curl += "-X " + method + " "; curl += "-X " + method + " ";
} }
else if (method === 'OPTION') { else if (method === 'OPTION') {
response = internal.arango.OPTION_RAW(url, body); response = internal.arango.OPTION_RAW(url, body, headers);
curl += "-X " + method + " "; curl += "-X " + method + " ";
} }
if (headers !== undefined && headers !== "") { if (headers !== undefined && headers !== "") {
curl += "--header \'" + headers + "\' "; for (i in headers) {
if (headers.hasOwnProperty(i)) {
curl += "--header \'" + i + ":" + headers[i] + "\' ";
}
}
} }
if (body !== undefined && body !== "") { if (body !== undefined && body !== "") {