Skip to content

Commit d5e507a

Browse files
committed
Add snippets for mocking requests and responses
Closes #17
1 parent b34bbff commit d5e507a

File tree

2 files changed

+49
-23
lines changed

2 files changed

+49
-23
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ The Dev Proxy extension makes it easy to create and update configuration files.
1414
| `devproxy-config-file-schema` | Dev Proxy config file schema |
1515
| `devproxy-mocks-file` | Dev Proxy mocks file |
1616
| `devproxy-mocks-file-schema` | Dev Proxy mocks file schema |
17+
| `devproxy-mock` | Dev Proxy mock |
18+
| `devproxy-request` | Dev Proxy request |
19+
| `devproxy-response` | Dev Proxy response |
20+
| `devproxy-response-header` | Dev Proxy response header |
1721
| `devproxy-plugin-caching-guidance` | CachingGuidancePlugin instance |
1822
| `devproxy-plugin-caching-guidance-config` | CachingGuidancePlugin config section |
1923
| `devproxy-plugin-crud-api` | CrudApiPlugin instance |
@@ -53,8 +57,6 @@ The Dev Proxy extension makes it easy to create and update configuration files.
5357
| `devproxy-plugin-rate-limiting-file` | Dev Proxy rate limiting file |
5458
| `devproxy-plugin-rate-limiting-file-schema` | Dev Proxy rate limiting file schema |
5559
| `devproxy-plugin-retry-after` | RetryAfterPlugin instance |
56-
| `devproxy-response` | Dev Proxy response |
57-
| `devproxy-response-header` | Dev Proxy response header |
5860

5961
### Diagnostics
6062

src/snippets.json

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,51 @@
3434
],
3535
"description": "Dev Proxy mocks file schema"
3636
},
37+
"Mock": {
38+
"prefix": "devproxy-mock",
39+
"body": [
40+
"\r",
41+
"\t{",
42+
"\t\t\"request\": {",
43+
"\t\t\t\"url\": \"$1\"",
44+
"\t\t},",
45+
"\t\t\"response\": {$2}",
46+
"\t}\r"
47+
],
48+
"description": "Dev Proxy mock"
49+
},
50+
"Request": {
51+
"prefix": "devproxy-request",
52+
"body": [
53+
"\t\"request\": {",
54+
"\t\t\"url\": \"$1\"",
55+
"\t},",
56+
"\t\"response\": {$2}",
57+
"}"
58+
],
59+
"description": "Dev Proxy request"
60+
},
61+
"Response": {
62+
"prefix": "devproxy-response",
63+
"body": [
64+
"\r",
65+
"\t\"statusCode\": ${1:400},",
66+
"\t\"body\": {$2},",
67+
"\t\"headers\": [$3]\r"
68+
],
69+
"description": "Dev Proxy response"
70+
},
71+
"ResponseHeader": {
72+
"prefix": "devproxy-response-header",
73+
"body": [
74+
"\r",
75+
"{",
76+
"\t\"name\": \"$1\",",
77+
"\t\"value\": \"$2\"",
78+
"}\r"
79+
],
80+
"description": "Dev Proxy response header"
81+
},
3782
"CachingGuidancePlugin": {
3883
"prefix": "devproxy-plugin-caching-guidance",
3984
"body": [
@@ -506,26 +551,5 @@
506551
"}"
507552
],
508553
"description": "RetryAfterPlugin instance"
509-
},
510-
"Response": {
511-
"prefix": "devproxy-response",
512-
"body": [
513-
"{",
514-
"\t\"statusCode\": ${1:400},",
515-
"\t\"body\": {$2},",
516-
"\t\"headers\": [$3]",
517-
"}"
518-
],
519-
"description": "Dev Proxy response"
520-
},
521-
"ResponseHeader": {
522-
"prefix": "devproxy-response-header",
523-
"body": [
524-
"{",
525-
"\t\"name\": \"$1\",",
526-
"\t\"value\": \"$2\"",
527-
"}"
528-
],
529-
"description": "Dev Proxy response header"
530554
}
531555
}

0 commit comments

Comments
 (0)