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

Function fetch

samples/http/getToApiGW.js:41–49  ·  view source on GitHub ↗

* Sends an HTTP request * @param {string} resourcePath path of the request * @param {Object} [options] values to publish * @param {'PUT' | 'POST' | 'GET' | 'DELETE' | 'PATCH'} [options.method] the request method * @param {Object. } [options.headers] the request headers * @param {

(resourcePath, options)

Source from the content-addressed store, hash-verified

39 * @returns {import('@aws-appsync/utils').HTTPRequest} the request
40 */
41function fetch(resourcePath, options) {
42 const { method = 'GET', headers, body: _body, query } = options;
43 const body = typeof _body === 'object' ? JSON.stringify(_body) : _body;
44 return {
45 resourcePath,
46 method,
47 params: { headers, query, body },
48 };
49}

Callers 1

requestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected