Class HttpRequestExecutor

java.lang.Object
ai.nervemind.app.executor.HttpRequestExecutor
All Implemented Interfaces:
NodeExecutor

@Component public class HttpRequestExecutor extends Object implements NodeExecutor
Node executor for HTTP Request operations.

This executor makes HTTP calls to external APIs and services. It supports all standard HTTP methods, custom headers, authentication, and template interpolation for dynamic values.

Node Configuration

HTTP Request node parameters
Parameter Type Required Description
url String Yes The URL to call (supports {{var}} interpolation)
method String No HTTP method: GET, POST, PUT, DELETE, etc. (default: GET)
headers Map No Custom HTTP headers
body String No Request body (supports interpolation)
timeout Integer No Timeout in seconds (default from settings)

Output Data

The executor outputs a Map with the following keys:

  • statusCode - HTTP status code (e.g., 200, 404)
  • body - Response body as string
  • headers - Response headers as Map
  • success - Boolean, true if status is 2xx
  • json - Response body (if detected as JSON)

Template Interpolation

URL and body support {{variableName}} syntax for dynamic values:

  • Variables from input data (previous node output)
  • Workflow settings
  • Stored credentials (referenced by name)

Authentication

For authenticated requests, either:

  • Assign a credential to the node (adds Bearer token header)
  • Use {{credentialName}} in headers/URL for manual auth

Performance

Uses virtual threads (Project Loom) for efficient non-blocking I/O.

Since:
1.0.0
See Also:
  • Constructor Details

    • HttpRequestExecutor

      public HttpRequestExecutor(ai.nervemind.common.service.SettingsServiceInterface settingsService)
      Creates a new HTTP request executor with configured timeouts.
      Parameters:
      settingsService - the settings service for timeout configuration
  • Method Details

    • execute

      public Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String,Object> input, ExecutionService.ExecutionContext context)
      Description copied from interface: NodeExecutor
      Executes the business logic for this node type.
      Specified by:
      execute in interface NodeExecutor
      Parameters:
      node - The node definition containing parameters and configuration. Use Node.parameters() to access user settings.
      input - Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.
      context - Verification context providing access to workflow-scoped services, logger, and execution metadata.
      Returns:
      A Map containing the results of this node's execution. Keys in this map become available variables for downstream nodes.
      Note: Returning null is treated as an empty map.
    • getNodeType

      public String getNodeType()
      Description copied from interface: NodeExecutor
      Unique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.
      Specified by:
      getNodeType in interface NodeExecutor
      Returns:
      The unique type string (e.g., "httpRequest", "llmChat").