From 710308c0cb3106aa4fa849da5fdc9bb83083284a Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Mon, 24 Feb 2025 17:22:14 +0000 Subject: [PATCH] Add new Dev Proxy rewrite snippets. Closes #199 Closes #199 --- CHANGELOG.md | 6 ++++++ README.md | 3 +++ src/snippets.json | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37ebfd3..df487f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.17.2] - Unreleased +### Added: + +- Snippets: `devproxy-rewrite` - Dev Proxy rewrite +- Snippets: `devproxy-plugin-rewrite-file` - RewritePlugin rewrites file +- Snippets: `devproxy-plugin-rewrite-file-schema` - RewritePlugin rewrites file schema + ### Changed: - Snippets: Updated schema urls to reflect the move to dotnet organisation in Github diff --git a/README.md b/README.md index bd5da0f..fb2e2d6 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Shown when the active document is a Dev Proxy configuration file | `devproxy-request` | Dev Proxy request | | `devproxy-response` | Dev Proxy response | | `devproxy-response-header` | Dev Proxy response header | +| `devproxy-rewrite` | Dev Proxy rewrite | | `devproxy-plugin-auth` | AuthPlugin instance | | `devproxy-plugin-auth-config-apikey` | AuthPlugin API Key config section | | `devproxy-plugin-auth-config-oauth2` | AuthPlugin OAuth2 config section | @@ -136,6 +137,8 @@ Shown when the active document is a Dev Proxy configuration file | `devproxy-plugin-rate-limiting-file-schema` | Dev Proxy rate limiting file schema | | `devproxy-plugin-retry-after` | RetryAfterPlugin instance | | `devproxy-plugin-rewrite` | RewritePlugin instance | +| `devproxy-plugin-rewrite-file` | RewritePlugin rewrites file | +| `devproxy-plugin-rewrite-file-schema` | RewritePlugin rewrites file schema | | `devproxy-plugin-rewrite-config` | RewritePlugin config section | | `devproxy-plugin-url-discovery` | UrlDiscoveryPlugin instance | | `devproxy-reporter-json` | JsonReporter instance | diff --git a/src/snippets.json b/src/snippets.json index 546940f..fba4a17 100644 --- a/src/snippets.json +++ b/src/snippets.json @@ -110,6 +110,20 @@ ], "description": "Dev Proxy response header" }, + "Rewrite":{ + "prefix": "devproxy-rewrite", + "body": [ + "{", + "\t\"in\": {", + "\t\t\"url\": \"$1\"", + "\t},", + "\t\"out\": {", + "\t\t\"url\": \"$2\"", + "\t}", + "}" + ], + "description": "Dev Proxy rewrite" + }, "AuthPlugin": { "prefix": "devproxy-plugin-auth", "body": [ @@ -889,6 +903,25 @@ ], "description": "RewritePlugin instance" }, + "RewritePluginFile":{ + "prefix": "devproxy-plugin-rewrite-file", + "body": [ + "{", + "\t\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.25.0/rewriteplugin.rewritesfile.schema.json\",", + "\t\"rewrites\": [", + "\t\t$1", + "\t]", + "}" + ], + "description": "RewritePlugin rewrites file" + }, + "RewritePluginFileSchema":{ + "prefix": "devproxy-plugin-rewrite-file-schema", + "body": [ + "\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.25.0/rewriteplugin.rewritesfile.schema.json\"," + ], + "description": "RewritePlugin rewrites file schema" + }, "RewritePluginConfig":{ "prefix": "devproxy-plugin-rewrite-config", "body": [ @@ -898,7 +931,7 @@ "}" ], "description": "RewritePlugin config section" - }, + }, "UrlDiscoveryPlugin": { "prefix": "devproxy-plugin-url-discovery", "body": [