Skip to content

Instantly share code, notes, and snippets.

@arscan
Last active December 16, 2015 13:08
Show Gist options
  • Save arscan/5439148 to your computer and use it in GitHub Desktop.
Save arscan/5439148 to your computer and use it in GitHub Desktop.
Simple test case for headers for hubble.
// node server.js
// should print out 3 lines each time the tests polls, 1 without special headers, 1 with 1 header, 1 with 2 headers
var http = require('http');
http.createServer(function (req, res) {
console.log(JSON.stringify(req.headers));
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(JSON.stringify({"status":"up"}));
}).listen(9615);
curl http://localhost:9999 \
-d column=0 \
-d label="No header" \
-d poll_url="http://localhost:9615" \
-d poll_seconds=10 \
-d poll_failed="Bummer :(" \
-d poll_method="json_value:^.status"
curl http://localhost:9999 \
-d column=0 \
-d label="One header" \
-d poll_url="http://localhost:9615" \
-d poll_header="xapi-key: dakey" \
-d poll_seconds=10 \
-d poll_failed="Bummer :(" \
-d poll_method="json_value:^.status"
curl http://localhost:9999 \
-d column=0 \
-d label="Two header" \
-d poll_url="http://localhost:9615" \
-d poll_header="xapi-key: dakey" \
-d poll_header="xapi-token: datoken" \
-d poll_seconds=10 \
-d poll_failed="Bummer :(" \
-d poll_method="json_value:^.status"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment