n8n-nodes-deepidv
Version:
n8n community node to integrate with the DeepIDV identity verification API
62 lines • 2.17 kB
JavaScript
;
// nodes/HttpBin/Httpbin.node.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.Httpbin = void 0;
class Httpbin {
constructor() {
this.description = {
displayName: 'HTTPBin',
name: 'httpbin',
icon: 'file:httpbin.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"]}}',
description: 'Interact with httpbin.org',
defaults: {
name: 'HTTPBin',
// color removed per lint rules
},
inputs: ['main'],
outputs: ['main'],
properties: [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{ name: 'GET', value: 'get' },
{ name: 'POST', value: 'post' },
],
default: 'get', // ← now exactly one of the option values
description: 'HTTP method to use',
},
{
displayName: 'URL Path',
name: 'path',
type: 'string',
default: '/get',
description: 'Path on httpbin.org (e.g. /status/200)',
},
],
};
}
async execute() {
const items = this.getInputData();
const results = [];
for (let i = 0; i < items.length; i++) {
// operation is 'get' | 'post'
const operation = this.getNodeParameter('operation', i);
const path = this.getNodeParameter('path', i);
const response = await this.helpers.request({
method: operation.toUpperCase(),
uri: `https://httpbin.org${path}`,
json: true,
});
results.push({ json: response });
}
return this.prepareOutputData(results);
}
}
exports.Httpbin = Httpbin;
//# sourceMappingURL=Httpbin.node.js.map