Socket
Book a DemoInstallSign in
Socket

directus-extension-request-url-with-more-settings

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directus-extension-request-url-with-more-settings

Send HTTP requests with advanced settings: redirect behavior, and optional raw body output

1.0.2
latest
npmnpm
Version published
Weekly downloads
9
-90.22%
Maintainers
1
Weekly downloads
 
Created
Source

directus-extension-request-url-with-more-settings

A Directus Flow operation to send HTTP requests with advanced settings: custom method, URL, headers, body, redirect behavior, and optional raw body output.

  • Operation type: operation
  • Language: TypeScript
  • Uses global fetch (Node.js 18+)
  • Output shape compatible with Directus built-in “request” operation:
    • { status, statusText, headers, data?, rawBody? }

Features

  • HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS (or any custom)
  • URL
  • Headers: list of { header, value }
  • Body (auto-JSON when object and no Content-Type provided)
  • followRedirects: follow or not (manual) redirects
  • rawBody: optionally returns base64-encoded raw response body as a Data URL
  • Smart response parsing:
    • JSON → parsed into data
    • text/* → parsed into data
    • binary (e.g. image, pdf) → data omitted, only rawBody returned
  • Can be used to forward or upload remote files (e.g. fetch image → send to another API)

Usage in a Flow

  • Add operation: HTTP Request (Advanced)
  • Options:
    • Method: e.g., GET
    • URL: e.g., https://httpbin.org/get?hello=world
    • Headers: []
    • Body: empty or JSON
    • Follow redirects: true/false
    • Return raw body (base64 Data URL): true/false

Output

Example with JSON:

{
  "status": 200,
  "statusText": "OK",
  "headers": {
    "content-type": "application/json"
  },
  "data": { "example": "value" }
}

Example with HTML when rawBody = true:

{
  "status": 200,
  "statusText": "OK",
  "headers": { "content-type": "text/html" },
  "data": "<html>...</html>",
  "rawBody": "data:text/html;base64,PGh0bWw+Li4uPC9odG1sPg=="
}

Example with an image file when rawBody = true:

{
  "status": 200,
  "statusText": "OK",
  "headers": { "content-type": "image/jpeg" },
  "rawBody": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."
}

Note: in this case, data is omitted because the response is binary.

Options Reference

  • method: string (default: GET)
  • url: string (required)
  • headers: Array<{ header: string; value: string }>
  • body: any
  • followRedirects: boolean (default: true)
  • rawBody: boolean (default: false)

Behavior

  • When body is an object and Content-Type isn’t set, it is sent as JSON (application/json; charset=utf-8).
  • When followRedirects = false, fetch uses redirect: "manual".
  • Response parsing:
    • If Content-Type includes application/json → parsed as JSON in data.
    • If Content-Type starts with text/ → parsed as text in data.
    • Otherwise (binary file) → omit data, only return rawBody as base64 Data URL.

Example Flow

  • Trigger: Webhook (key: test-http)
  • Step 1: HTTP Request (Advanced)
  • Optional Step 2: Log
    • Message: {{ steps.step1.status }} - {{ steps.step1.data.url }}

License

MIT Dan Denolf

Keywords

directus

FAQs

Package last updated on 21 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.