2022-06-14 16:31:05 +02:00
|
|
|
import { INodeType, INodeTypeDescription } from "n8n-workflow";
|
|
|
|
|
|
2022-06-14 17:02:04 +02:00
|
|
|
// Description of our Node
|
2022-06-14 16:31:05 +02:00
|
|
|
export class HttpBin implements INodeType {
|
|
|
|
|
description: INodeTypeDescription = {
|
|
|
|
|
displayName: "HttpBin",
|
|
|
|
|
name: "httpbin",
|
|
|
|
|
icon: "file:httpbin.svg",
|
|
|
|
|
group: ["transform"],
|
|
|
|
|
version: 1,
|
|
|
|
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
|
|
|
description: "Interact with HttpBin API",
|
|
|
|
|
defaults: {
|
2022-06-14 17:02:04 +02:00
|
|
|
name: "HttpBin",
|
|
|
|
|
color: "#3b4151",
|
2022-06-14 16:31:05 +02:00
|
|
|
},
|
|
|
|
|
inputs: ["main"],
|
|
|
|
|
outputs: ["main"],
|
|
|
|
|
credentials: [
|
|
|
|
|
{
|
2022-06-14 17:02:04 +02:00
|
|
|
name: "httpbinApi",
|
|
|
|
|
required: false,
|
2022-06-14 16:31:05 +02:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
requestDefaults: {
|
|
|
|
|
baseURL: "={{$credentials.domain}}",
|
|
|
|
|
url: "",
|
|
|
|
|
headers: {
|
|
|
|
|
Accept: "application/json",
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-06-14 17:02:04 +02:00
|
|
|
/**
|
|
|
|
|
* In the properties array we have two mandatory options objects required
|
|
|
|
|
*
|
|
|
|
|
* Resource & Operation
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
properties: [
|
|
|
|
|
{
|
|
|
|
|
displayName: "Resource",
|
|
|
|
|
name: "resource",
|
|
|
|
|
type: "options",
|
|
|
|
|
noDataExpression: true,
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: "Http Verbs",
|
|
|
|
|
value: "httpverbs",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "Auth Methods",
|
|
|
|
|
value: "authmethods",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
default: "httpverbs",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: "Operation",
|
|
|
|
|
name: "operation",
|
|
|
|
|
type: "options",
|
|
|
|
|
noDataExpression: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
resource: ["httpverbs"],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: "GET",
|
|
|
|
|
value: "getMethod",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
default: "getMethod",
|
|
|
|
|
},
|
|
|
|
|
],
|
2022-06-14 16:31:05 +02:00
|
|
|
};
|
|
|
|
|
}
|