MCPcopy Create free account
hub / github.com/aws-samples/aws-appsync-resolver-samples / response

Function response

samples/http/translate.js:18–25  ·  view source on GitHub ↗
(ctx)

Source from the content-addressed store, hash-verified

16 * @returns {string} the translated text
17 */
18export function response(ctx) {
19 const { result } = ctx;
20 if (result.statusCode !== 200) {
21 return util.appendError(result.body, `${result.statusCode}`);
22 }
23 const body = JSON.parse(result.body);
24 return body.TranslatedText;
25}
26
27/**
28 * Sends a request to the Translate service

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected