Closed techguydave closed 9 years ago
Nevermind. Didn't realize I had to set the header to application/json
.
Hi synth3tk, how can you do it?
My code is not working
var headers = {
"Authorization": "token " + accessToken,
"Content-Type" : "application/json"
};
var id = "12345678";
var updatedData = {
description: 'update doc',
public: true,
files: {
'updated.md': { content: 'updated' }
}
}
rest
.patch(
"https://api.github.com/gists/" + id,
{
data: JSON.stringify(updatedData)
},
{
headers: headers,
})
.on('complete', function(result){
console.log(result);
})
Use node-debugger
, I found that rest
object's headers doesn't contains Content-Type
property
headers: Object
Accept: "*/*"
Accept-Encoding: "gzip, deflate"
Content-Length: 75
Host: "api.github.com"
User-Agent: "Restler for node.js"
Does the
PATCH
method not include a way to send the body likePOST
andPUT
?