惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
博客园_首页
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
月光博客
月光博客
小众软件
小众软件
S
SegmentFault 最新的问题
量子位
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Stop writing auth boilerplate: API automation with pre/po...
eknut w. · 2026-05-12 · via DEV Community

If you've spent more than a few hours testing APIs, you know the drill: copy the token from the previous response, paste it into the Authorization header of the next request, remember to re-sign the HMAC payload before sending, then manually check the response body for the field you actually care about.

It's tedious. It breaks your flow. And it's completely automatable.

APIKumo has a pre/post processor pipeline baked directly into every request — no plugins, no scripts stored somewhere off to the side, no separate test runner. Here's how it works and why it matters.


What are pre/post processors?

Every request in APIKumo can have two processor layers:

  • Pre-processors run before the request is sent — they can modify headers, compute signatures, inject dynamic values, or run custom JavaScript.
  • Post-processors run after the response arrives — they can extract values, assert on status codes or body fields, log output, or pass data forward to the next request.

Together they form a mini pipeline that makes your collection self-sufficient.


Common pre-processor use cases

1. HMAC request signing

Many payment, security, and internal APIs require requests to be signed with an HMAC-SHA256 digest computed from the request body + a timestamp. Without automation you'd compute this in a terminal, copy it, paste it — every single time.

In APIKumo, a pre-processor can do it for you:

const crypto = require("crypto");
const ts = Date.now().toString();
const body = request.body ?? "";
const sig = crypto
  .createHmac("sha256", env.SIGNING_SECRET)
  .update(ts + "." + body)
  .digest("hex");

request.headers["X-Timestamp"] = ts;
request.headers["X-Signature"] = `v1=${sig}`;

Enter fullscreen mode Exit fullscreen mode

Save once. It runs on every send, automatically pulling SIGNING_SECRET from your environment — which can differ between staging and production.

2. Bearer token from environment

Got a /auth/token endpoint that you hit to get a JWT? Instead of manually copying the token, set it in an environment variable and reference it:

{{AUTH_TOKEN}}

Enter fullscreen mode Exit fullscreen mode

Pair that with a post-processor on the login request (see below) and the token refreshes itself.

3. Timestamp nonces

Some APIs reject replayed requests by requiring a unique nonce or timestamp in a header. Pre-processors can inject Date.now() or a UUID before every send, without you thinking about it.


Common post-processor use cases

1. Extract and store a JWT

After a successful login, capture the token and save it to an environment variable:

const token = response.json.access_token;
env.set("AUTH_TOKEN", token);

Enter fullscreen mode Exit fullscreen mode

Now every subsequent request in the collection that uses {{AUTH_TOKEN}} picks it up automatically. This is especially powerful when you chain a sequence of requests — login → create resource → fetch resource → delete — because each step feeds the next.

2. Assert on status and body

Post-processors double as lightweight tests:

assert(response.status === 200, "Expected 200 OK");
assert(response.json.id !== undefined, "Response missing id field");

Enter fullscreen mode Exit fullscreen mode

Assertions surface clearly in the response panel. Run through a collection and you'll immediately see which steps passed and which didn't — no separate test suite needed.

3. JSONPath and regex extraction

APIKumo includes built-in JSONPath and regex extractors so you don't have to write custom JS for straightforward cases:

  • JSONPath: $.data.user.id → store in USER_ID
  • Regex: extract an order number from a plain-text response body
  • Header: capture a Set-Cookie value or Location redirect header

Environments tie it all together

Pre/post processors resolve {{variables}} from whichever environment is active. Switch from Staging to Production in one click and the same processors run against the right base URL, credentials, and secrets — without touching any processor code.

This is what makes collections genuinely reusable across teams. A new teammate clones the collection, fills in their own environment values, and every auth flow just works.


A real-world example: testing a webhook flow

Here's a simple three-request chain that would otherwise require constant manual copy-pasting:

  1. POST /sessions — pre-processor injects HMAC signature; post-processor extracts session_idSESSION_ID
  2. POST /webhooks — pre-processor uses {{SESSION_ID}} in the body; post-processor extracts webhook_secretWH_SECRET
  3. POST /events/simulate — pre-processor signs the payload with {{WH_SECRET}}; post-processor asserts status 202

Three requests, zero manual copy-pasting, zero terminal tabs open on the side.


Why this beats a separate test runner

The usual alternative is to put this logic in a Postman test script, a shell script, or a pytest fixture. Those work — but they live outside your API workspace. Someone updates an endpoint and forgets to update the test script. The docs go stale. The scripts accumulate in a repo no one remembers to run.

APIKumo keeps processors inside the request, right next to the URL, headers, and body. When you publish that collection to a docs subdomain, the processors stay in the workspace while the docs reflect the actual schema — everything in one place.


Getting started

If you haven't tried APIKumo yet, it's free while in preview.

  1. Go to apikumo.com and sign in with Google, GitHub, or Discord.
  2. Create a new collection and add a request to an API you work with.
  3. Open the Pre-processors tab on any request and try injecting a timestamp header.
  4. Open Post-processors and add a JSONPath extractor or a status assertion.

The feedback loop is fast — you'll see exactly what each processor did in the response panel on every send.


API automation shouldn't require a separate tool. If your API client can't sign your requests, chain your calls, and assert on your responses without leaving the tab — it's time to upgrade.

— The APIKumo team