forked from CodeGenieApp/serverless-express
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: added kinesis data stream eventsource (CodeGenieApp#531)
* Added Kinesis DataStream EventSource * test: added for kinesis dataStream events * docs: added documentation for kinesis data stream events Co-authored-by: brett-vendia <72168202+brett-vendia@users.noreply.github.com>
- Loading branch information
1 parent
36db4b1
commit f7f3f6c
Showing
7 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const eventSources = require('../src/event-sources') | ||
const testUtils = require('./utils') | ||
|
||
const kinesisDataStreamEventSource = eventSources.getEventSource({ | ||
eventSourceName: 'AWS_KINESIS_DATA_STREAM' | ||
}) | ||
|
||
test('request is correct', () => { | ||
const req = getReq() | ||
expect(typeof req).toEqual('object') | ||
expect(req.headers).toEqual({ host: 'kinesis.amazonaws.com' }) | ||
expect(req.body).toEqual(testUtils.kinesisDataStreamEvent) | ||
expect(req.method).toEqual('POST') | ||
}) | ||
|
||
function getReq () { | ||
const event = testUtils.kinesisDataStreamEvent | ||
const request = kinesisDataStreamEventSource.getRequest({ event }) | ||
return request | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { emptyResponseMapper } = require('../utils') | ||
|
||
const getRequestValuesFromKinesis = ({ event }) => { | ||
const method = 'POST' | ||
const headers = { host: 'kinesis.amazonaws.com' } | ||
const body = event | ||
|
||
return { | ||
method, | ||
headers, | ||
body | ||
} | ||
} | ||
|
||
module.exports = { | ||
getRequest: getRequestValuesFromKinesis, | ||
getResponse: emptyResponseMapper | ||
} |
This file contains 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
This file contains 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