From bc7a927c259a773027a3d0c3e7ba29d897fd1569 Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Tue, 11 Feb 2025 13:43:46 +0000 Subject: [PATCH 1/3] Update http-cats sample to schema v0.24 and refine error response structure --- samples/http-cats/README.md | 1 + samples/http-cats/http-cats-config.json | 19 +-- samples/http-cats/http-cats-responses.json | 158 +++++++++++---------- 3 files changed, 86 insertions(+), 92 deletions(-) diff --git a/samples/http-cats/README.md b/samples/http-cats/README.md index bd10a57..68261cc 100644 --- a/samples/http-cats/README.md +++ b/samples/http-cats/README.md @@ -25,6 +25,7 @@ Use this preset to return funny cat images when simulating erroneous HTTP status Version|Date|Comments -------|----|-------- +1.5|February 11, 2025|Updated to 0.24 schema 1.4|January 17, 2024|Updated plugin path 1.3|January 11, 2024|Updated to new format 1.2|December 22, 2023|Updated to new format diff --git a/samples/http-cats/http-cats-config.json b/samples/http-cats/http-cats-config.json index 949a590..f1d65d4 100644 --- a/samples/http-cats/http-cats-config.json +++ b/samples/http-cats/http-cats-config.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.24.0/rc.schema.json", "plugins": [ { "name": "GenericRandomErrorPlugin", @@ -21,26 +22,10 @@ "https://*.sharepoint-df.*/*_api/*", "https://*.sharepoint-df.*/*_vti_bin/*" ], - "mocksPlugin": { - "mocksFile": "responses.json" - }, - "graphRandomErrorsPlugin": { - "allowedErrors": [ - 429, - 500, - 502, - 503, - 504, - 507 - ] - }, - "executionSummaryPlugin": { - "groupBy": "url" - }, "httpCats": { "errorsFile": "http-cats-responses.json" }, "rate": 50, "labelMode": "text", - "logLevel": "info" + "logLevel": "information" } \ No newline at end of file diff --git a/samples/http-cats/http-cats-responses.json b/samples/http-cats/http-cats-responses.json index 5a16eb7..2ce0a27 100644 --- a/samples/http-cats/http-cats-responses.json +++ b/samples/http-cats/http-cats-responses.json @@ -1,92 +1,100 @@ { - "responses": [ + "$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.24.0/genericrandomerrorplugin.schema.json", + "errors": [ { - "statusCode": 429, - "headers": [ + "request": { + "url": "https://*/*" + }, + "responses": [ { - "name": "content-type", - "value": "image/jpeg" + "statusCode": 429, + "headers": [ + { + "name": "content-type", + "value": "image/jpeg" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "name": "Retry-After", + "value": "@dynamic" + } + ], + "body": "@http-cats/429.jpeg" }, { - "name": "Access-Control-Allow-Origin", - "value": "*" + "statusCode": 500, + "headers": [ + { + "name": "content-type", + "value": "image/jpeg" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "body": "@http-cats/500.jpeg" }, { - "name": "Retry-After", - "value": "@dynamic" - } - ], - "body": "@http-cats/429.jpeg" - }, - { - "statusCode": 500, - "headers": [ - { - "name": "content-type", - "value": "image/jpeg" + "statusCode": 502, + "headers": [ + { + "name": "content-type", + "value": "image/jpeg" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "body": "@http-cats/502.jpeg" }, { - "name": "Access-Control-Allow-Origin", - "value": "*" - } - ], - "body": "@http-cats/500.jpeg" - }, - { - "statusCode": 502, - "headers": [ - { - "name": "content-type", - "value": "image/jpeg" + "statusCode": 503, + "headers": [ + { + "name": "content-type", + "value": "image/jpeg" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "body": "@http-cats/503.jpeg" }, { - "name": "Access-Control-Allow-Origin", - "value": "*" - } - ], - "body": "@http-cats/502.jpeg" - }, - { - "statusCode": 503, - "headers": [ - { - "name": "content-type", - "value": "image/jpeg" - }, - { - "name": "Access-Control-Allow-Origin", - "value": "*" - } - ], - "body": "@http-cats/503.jpeg" - }, - { - "statusCode": 504, - "headers": [ - { - "name": "content-type", - "value": "image/jpeg" - }, - { - "name": "Access-Control-Allow-Origin", - "value": "*" - } - ], - "body": "@http-cats/504.jpeg" - }, - { - "statusCode": 507, - "headers": [ - { - "name": "content-type", - "value": "image/jpeg" + "statusCode": 504, + "headers": [ + { + "name": "content-type", + "value": "image/jpeg" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "body": "@http-cats/504.jpeg" }, { - "name": "Access-Control-Allow-Origin", - "value": "*" + "statusCode": 507, + "headers": [ + { + "name": "content-type", + "value": "image/jpeg" + }, + { + "name": "Access-Control-Allow-Origin", + "value": "*" + } + ], + "body": "@http-cats/507.jpeg" } - ], - "body": "@http-cats/507.jpeg" + ] } ] } \ No newline at end of file From bf1ab764489d8be1abd80b26969886a1f47e2979 Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Tue, 11 Feb 2025 13:57:06 +0000 Subject: [PATCH 2/3] Update sample.json with new update date for http-cats asset --- samples/http-cats/assets/sample.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/http-cats/assets/sample.json b/samples/http-cats/assets/sample.json index a98dea1..526490e 100644 --- a/samples/http-cats/assets/sample.json +++ b/samples/http-cats/assets/sample.json @@ -10,7 +10,7 @@ "Testing doesn't have to boring! Use this preset to return funny cat images when simulating erroneous HTTP status codes for Microsoft Graph. This preset contains images for the following HTTP status codes: 429, 500, 502, 503, 504 and 507. When you test your app in the browser, and the Dev Proxy returns one of these status codes, you will see a funny cat image instead of a boring error message. Have fun! 🐱 HTTP cat pictures by Tomomi Imura." ], "creationDateTime": "2023-08-10", - "updateDateTime": "2024-01-17", + "updateDateTime": "2025-02-11", "products": [ "Dev Proxy", "Microsoft Graph" From 9d40cdb4c2eb3009c19c8c4c55cc04f45170d8c6 Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Tue, 11 Feb 2025 14:05:37 +0000 Subject: [PATCH 3/3] Update schema URL in http-cats config to point to the dotnet repository --- samples/http-cats/http-cats-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/http-cats/http-cats-config.json b/samples/http-cats/http-cats-config.json index f1d65d4..7aaa24b 100644 --- a/samples/http-cats/http-cats-config.json +++ b/samples/http-cats/http-cats-config.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.24.0/rc.schema.json", + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.24.0/rc.schema.json", "plugins": [ { "name": "GenericRandomErrorPlugin",