* 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)
| 53 | * @returns {import('@aws-appsync/utils').HTTPRequest} the request |
| 54 | */ |
| 55 | function fetch(resourcePath, options) { |
| 56 | const { method = 'GET', headers, body: _body, query } = options; |
| 57 | const body = typeof _body === 'object' ? JSON.stringify(_body) : _body; |
| 58 | return { |
| 59 | resourcePath, |
| 60 | method, |
| 61 | params: { headers, query, body }, |
| 62 | }; |
| 63 | } |
no outgoing calls
no test coverage detected