mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-11-18 14:48:20 +01:00
- Add WireMockServerSettings.ScribanRegistrationCallback (Action<object, IFileSystemHandler>?) so code-configured servers can add functions, objects or variables to Scriban and Scriban-DotLiquid templates. - Pass the settings to ScribanContextFactory, which invokes the callback with a new ScriptObject per transformer context. - Push the custom globals beneath the template model in ScribanContext so request, response, mapping and data take precedence; keep the original Template.Render call when no callback is configured. - Add the strongly typed WithScribanRegistration extension method. - Add a Scriban example to the .NET 8 console app. - Make the proxy tests use a local target server instead of www.google.com, and skip the IPv6 loopback test when the OS has no IPv6 support. Co-authored-by: Mattias <13809209+Quattordici@users.noreply.github.com>
This commit is contained in:
1 parent
64734c4f92
commit
0132ec873a
13 files changed
+527
-22
No files matched your search
@@ -194,6 +194,20 @@ public class WireMockServerSettings
|
||||
[JsonIgnore]
|
||||
public Action<IHandlebars, IFileSystemHandler>? HandlebarsRegistrationCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Action which can be used to add additional Scriban registrations (functions, objects or variables). [Optional]
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The first argument is a <c>Scriban.Runtime.ScriptObject</c> from the <c>Scriban.Signed</c> package.
|
||||
/// It is typed as <see cref="object"/> so that this package does not depend on Scriban.
|
||||
/// Members added to it are available as globals in <see cref="TransformerType.Scriban"/> and <see cref="TransformerType.ScribanDotLiquid"/> templates.
|
||||
/// On a name clash the template model (<c>request</c>, <c>response</c>, <c>mapping</c> and <c>data</c>) takes precedence.
|
||||
/// The action is invoked each time a transformer context is created.
|
||||
/// </remarks>
|
||||
[PublicAPI]
|
||||
[JsonIgnore]
|
||||
public Action<object, IFileSystemHandler>? ScribanRegistrationCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allow the usage of CSharpCodeMatcher (default is not allowed).
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user