MCPcopy Create free account
hub / github.com/serverless/examples / http

Function http

openwhisk-node-and-docker-chaining-functions/handler.js:7–26  ·  view source on GitHub ↗
(url, qs)

Source from the content-addressed store, hash-verified

5const request = require('request');
6
7function http(url, qs) {
8 const options = {
9 url, qs, json: true,
10 };
11
12 return new Promise((resolve, reject) => {
13 request(options, (err, resp) => {
14 if (err) {
15 console.log(err);
16 return reject({ err });
17 }
18 if (resp.body.status !== 'OK') {
19 console.log(resp.body.status);
20 return reject({ err: resp.body.status });
21 }
22
23 return resolve(resp.body);
24 });
25 });
26}
27
28function locationFromAddress(params) {
29 if (!params.address) return Promise.reject('Missing mandatory property: address');

Callers 2

locationFromAddressFunction · 0.85
sunriseSunsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected