stackvana / hook.io

Open-Source Microservice Hosting Platform
https://hook.io
Other
1.26k stars 117 forks source link

How to update hook source using the API #240

Closed pyhedgehog closed 7 years ago

pyhedgehog commented 8 years ago

I've found #221, but instruction there doesn't works:

C:\src\tests>cat hookupdate.js
var sdk = require("hook.io-sdk");

var client = sdk.createClient({});

client.hook.update('testeb43df31_2329bb48hook', { "source": 'print(globals())', "language": "python" }, function (err, res) {
  console.log(err, res)
});
C:\src\tests>node hookupdate.js
{ Error: socket hang up
    at createHangUpError (_http_client.js:250:15)
    at TLSSocket.socketOnEnd (_http_client.js:342:23)
    at emitNone (events.js:91:20)
    at TLSSocket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:926:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' } undefined

I've tried to do this with curl with same results:

$ curl -i -H "hookio-private-key: $hook_private_key" -H 'accept: application/json' --data 'source=print(globals())&owner=pythonsdktest&name=testeb43df31_2329bb48hook&language=python&save=save' 'https://hook.io/admin'
curl: (52) Empty reply from server
$ curl -i -H "hookio-private-key: $hook_private_key" -H 'accept: application/json' -H 'content-type: application/json' --data-raw '{"source":"print(globals())","owner":"pythonsdktest","name":"testeb43df31_2329bb48hook","language":"python","save":"save"}' 'https://hook.io/admin'
curl: (52) Empty reply from server
chriskruse commented 7 years ago

Any patch for this issue?

Marak commented 7 years ago

Checking today.

Will have an update shortly.

Marak commented 7 years ago

This should be hot-patched on production, was a one-line fix.

Commits coming.