oakserver / oak

A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕

Home Page:https://oakserver.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No clear guidance on how to create a mock route context with body

Skwai opened this issue · comments

I'm trying to write tests for a route I've created. However I cannot for the life of me figure out how to set the request.body on createMockContext. The request.body is readonly so clearly it's not intended to be mutated like so:

const ctx = createMockContext()
ctx.request.body = "foo"

I've tried so search the codebase but can't see any examples or interfaces for creating a mocked JSON request context.