Skip to content

updating metadata #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/builder_functions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const isPromise = require('is-promise')

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

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

return {
...response,
metadata: { version: 1, behavior: { name: 'builder' } },
metadata: { version: METADATA_VERSION, builder_function: BUILDER_FUNCTIONS_FLAG },
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/lib/consts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const BUILDER_FUNCTIONS_FLAG = true
const HTTP_STATUS_METHOD_NOT_ALLOWED = 405
const HTTP_STATUS_OK = 200
const METADATA_VERSION = 1

module.exports = { HTTP_STATUS_METHOD_NOT_ALLOWED, HTTP_STATUS_OK }
module.exports = {
BUILDER_FUNCTIONS_FLAG,
HTTP_STATUS_METHOD_NOT_ALLOWED,
HTTP_STATUS_OK,
METADATA_VERSION,
}
2 changes: 1 addition & 1 deletion test/builder_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { builderFunction } = require('../src/lib/builder_functions')

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

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

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