HTTP 200{
"status": 200,
"body": {
"code": 200,
"msg": "ok",
"data": {
"id": 42,
"name": "Ada"
}
}
}This page runs the repository's createHttp implementation in the browser. No mocked UI state or framework adapter sits between the scenario and the result.
Choose a backend response, run the repository's real createHttp, and compare the raw response with the final resolved value or rejected BizError.
createHttp()HTTP 200{
"status": 200,
"body": {
"code": 200,
"msg": "ok",
"data": {
"id": 42,
"name": "Ada"
}
}
}Ready to run// Run the scenario to inspect its resolved value or BizErrorHTTP 200 with an explicit { code, msg, data } policy resolves the inner data as User.
HTTP 200 with a failed business code rejects with BizError. Axios alone would resolve this response because the HTTP request succeeded.
With envelope omitted, core returns the parsed body and uses only HTTP status.
An envelope map reads errno, errmsg, and result without changing endpoint code.
HTTP status takes precedence. A stale body containing code: 200 cannot turn HTTP 503 into success.
The demo injects a small adapter and lets the configured hooks, response policy, and error pipeline process its HttpResponse.
const adapter: Adapter = {
name: "protocol-lab",
async request() {
return {
status: scenario.status,
statusText: scenario.statusText,
headers: { "x-demo": "protocol-lab" },
body: scenario.body,
};
},
};
const client = createHttp({
adapter,
envelope: scenario.envelope,
});
const result = await client.get<User>("/demo");The same adapter contract is used for axios, native fetch, ofetch, native bridges, and tests.