Skip to content

Commit f92c4f9

Browse files
authored
updating metadata (#12)
* updating metadata
1 parent fd92028 commit f92c4f9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/lib/builder_functions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const isPromise = require('is-promise')
22

3-
const { HTTP_STATUS_METHOD_NOT_ALLOWED, HTTP_STATUS_OK } = require('./consts')
3+
const { BUILDER_FUNCTIONS_FLAG, HTTP_STATUS_METHOD_NOT_ALLOWED, HTTP_STATUS_OK, METADATA_VERSION } = require('./consts')
44

55
const augmentResponse = (response) => {
66
if (!response || response.statusCode !== HTTP_STATUS_OK) {
@@ -9,7 +9,7 @@ const augmentResponse = (response) => {
99

1010
return {
1111
...response,
12-
metadata: { version: 1, behavior: { name: 'builder' } },
12+
metadata: { version: METADATA_VERSION, builder_function: BUILDER_FUNCTIONS_FLAG },
1313
}
1414
}
1515

src/lib/consts.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
const BUILDER_FUNCTIONS_FLAG = true
12
const HTTP_STATUS_METHOD_NOT_ALLOWED = 405
23
const HTTP_STATUS_OK = 200
4+
const METADATA_VERSION = 1
35

4-
module.exports = { HTTP_STATUS_METHOD_NOT_ALLOWED, HTTP_STATUS_OK }
6+
module.exports = {
7+
BUILDER_FUNCTIONS_FLAG,
8+
HTTP_STATUS_METHOD_NOT_ALLOWED,
9+
HTTP_STATUS_OK,
10+
METADATA_VERSION,
11+
}

test/builder_functions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { builderFunction } = require('../src/lib/builder_functions')
44

55
const { invokeLambda } = require('./helpers/main')
66

7-
const METADATA_OBJECT = { metadata: { version: 1, behavior: { name: 'builder' } } }
7+
const METADATA_OBJECT = { metadata: { version: 1, builder_function: true } }
88

99
test('Injects the metadata object into an asynchronous handler', async (t) => {
1010
const originalResponse = {

0 commit comments

Comments
 (0)