Urgent.News

What's breaking now, across thousands of outlets.

Tech

A 201 response is not an integration test: testing the webhook and final state

A payment API can create a resource successfully while the work behind that resource is still pending. If the test stops at 201 Created , it has checked resource creation, not the completion of the payment workflow. I'm the developer of Lucidra, a desktop workspace for API and integration work. This is one of the problems behind its scenario testing. The example below is independent of Lucidra:…

A 201 status code indicates that the API successfully created a resource, but it does not guarantee the completion of the payment workflow. A developer named Lucidra highlights this issue in their scenario testing. The following is an example that can be run locally without any dependencies. The example demonstrates three key facts: whether the request created the expected resource, if a matching completion event arrived with the correct payload, and if the API reported the final state.

It is easy to introduce a race condition by sending a request, extracting its ID, and then listening for a webhook. A fast callback might arrive before the listener is ready, and increasing the timeout will not recover a missed event. To avoid this, start a fresh receiver first and buffer events. The example deliberately sends an unrelated event before the correct event, both before returning the creation response.

This helps teach the importance of waiting for the right event before concluding the test. The code uses Node's built-in HTTP server, assertions, timers, fetch, and AbortSignal.timeout. It can be run with Node 20.15.1 or any maintained Node release. Running the code with the "--missing-webhook" flag will intentionally exit with code 1, while the command without this flag will exit with code 0.

Only the first command can prove that the expected event arrived and the resource reached a paid state.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I Scored Retry Loops. Boundedness Was Optional.

Boundedness failed first. Not the model. Not the schema. The ceiling. I stopped asking whether an agent was "actually thinking" and started asking a dumber question that still draws blood.

  • Boundedness was prioritized over loop functionality
  • Author questioned loop stopping condition if tool hung
  • Resilience without budget leads to unbounded costs

Diablo 5 Announced

Blizzard has officially announced Diablo 5 at BlizzCon 2026. Set entirely in a post-apocalyptic future 100 years after Diablo 4, the ARPG will release in 2029.

More from Saturday 12 September →