Interface IBowireScriptRunner
- Namespace
- Kuestenlogik.Bowire.Scripting
- Assembly
- Kuestenlogik.Bowire.dll
Runs a request's pre-request and post-response scripts outside the
browser (#672): in bowire test, and anywhere else a call is made on
the server side.
public interface IBowireScriptRunner
Remarks
The scripts are the ones a person writes in the workbench, against the
ctx surface of wwwroot/js/scripts.js. An implementation must
give them the same ctx and the same outcome as the browser; the one
in Kuestenlogik.Bowire.Scripting runs that very file in a sandboxed
JavaScript engine, and a conformance suite holds both to the same fixtures.
Core carries only this contract, so a host that embeds Bowire gains no
JavaScript engine. Where none is installed, Find()
answers null, and a caller with a script to run must fail the call
saying so, never skip the script.
Methods
RunPostResponse(BowireScriptCall)
Run a post-response script against Response.
BowireScriptResult RunPostResponse(BowireScriptCall script)
Parameters
scriptBowireScriptCall
Returns
RunPostResponseAsync(BowireScriptCall, CancellationToken)
#1111 — RunPostResponse(BowireScriptCall) for a script that may await.
ValueTask<BowireScriptResult> RunPostResponseAsync(BowireScriptCall script, CancellationToken ct = default)
Parameters
scriptBowireScriptCallctCancellationToken
Returns
RunPreRequest(BowireScriptCall)
Run a pre-request script; it may change Request.
BowireScriptResult RunPreRequest(BowireScriptCall script)
Parameters
scriptBowireScriptCall
Returns
RunPreRequestAsync(BowireScriptCall, CancellationToken)
#1111 — run a pre-request script that may await: a
ctx.sendRequest goes out through SendRequest
while the script waits. The default runs it as RunPreRequest(BowireScriptCall),
for a runner that predates awaiting scripts.
ValueTask<BowireScriptResult> RunPreRequestAsync(BowireScriptCall script, CancellationToken ct = default)
Parameters
scriptBowireScriptCallctCancellationToken