Created
August 28, 2017 16:37
-
-
Save theburningmonk/7017ddfadf779bfc1d41ad3398c075c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const co = require('co'); | |
const log = require('../lib/log'); | |
const snsHandler = require('../lib/snsHandler'); | |
const http = require('../lib/http'); | |
const reqContext = require('../lib/requestContext'); | |
module.exports.handler = snsHandler( | |
co.wrap(function* (event, context) { | |
reqContext.set("source-type", "sns"); | |
log.debug("this is a DEBUG log"); | |
log.info("this is an INFO log"); | |
log.warn("this is a WARNING log"); | |
log.error("this is an ERROR log"); | |
let host = reqContext.get()["x-correlation-host"]; | |
if (host) { | |
let uri = `https://${host}/dev/api-c`; | |
log.info("calling api-c", { uri }); | |
let reply = yield http({ | |
uri : uri, | |
method : 'GET' | |
}); | |
log.info(reply); | |
} | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment