-
Notifications
You must be signed in to change notification settings - Fork 668
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
const getRequestValuesFromSqs = ({ event }) => { | ||
const method = "POST"; | ||
const headers = { host: "sqs.amazonaws.com" }; | ||
const body = event; | ||
const method = 'POST' | ||
const headers = { host: 'sqs.amazonaws.com' } | ||
const body = event | ||
|
||
return { | ||
method, | ||
headers, | ||
body, | ||
}; | ||
}; | ||
} | ||
} | ||
|
||
const getResponseToSqs = ({ statusCode, body }) => { | ||
if (statusCode >= 400) { | ||
throw new Error(body); | ||
throw new Error(body) | ||
} | ||
return JSON.parse(body); | ||
}; | ||
|
||
return JSON.parse(body) | ||
} | ||
|
||
module.exports = { | ||
getRequest: getRequestValuesFromSqs, | ||
getResponse: getResponseToSqs, | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
const getRequestValuesFromStepFunctions = ({ event }) => { | ||
const method = "POST"; | ||
const headers = { host: "stepfunctions.amazonaws.com" }; | ||
const body = event; | ||
const method = 'POST' | ||
const headers = { host: 'stepfunctions.amazonaws.com' } | ||
const body = event | ||
|
||
return { | ||
method, | ||
headers, | ||
body, | ||
}; | ||
}; | ||
} | ||
} | ||
|
||
function getResponseToStepFunctions({ | ||
statusCode, | ||
body, | ||
isBase64Encoded = false, | ||
}) { | ||
if (statusCode >= 400) { | ||
throw new Error(body); | ||
throw new Error(body) | ||
} | ||
|
||
if (isBase64Encoded) { | ||
throw new Error("base64 encoding is not supported"); | ||
throw new Error('base64 encoding is not supported') | ||
} | ||
|
||
return JSON.parse(body); | ||
return JSON.parse(body) | ||
} | ||
|
||
module.exports = { | ||
getRequest: getRequestValuesFromStepFunctions, | ||
getResponse: getResponseToStepFunctions, | ||
}; | ||
} |