-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
039a02f
commit 8addf48
Showing
13 changed files
with
293 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@msw-devtools/demo': patch | ||
--- | ||
|
||
Update demo page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
![Private](https://img.shields.io/badge/status-private-red?) | ||
### Start dev server | ||
|
||
```bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,44 @@ | ||
### @msw-devtools/json-config | ||
![Private](https://img.shields.io/badge/status-private-red?) | ||
## @msw-devtools/json-config | ||
|
||
JSON config used by the extension to configure the responses. | ||
|
||
### Example config | ||
```json | ||
{ | ||
"version": 1, | ||
"name": "example", | ||
"handlers": { | ||
"/profile": { | ||
"method": "GET", | ||
"body": { | ||
"name": "Valentin", | ||
"surname": "Kruglikov", | ||
"location": "World" | ||
}, | ||
"init": { | ||
"headers": { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
}, | ||
"/forbidden": { | ||
"method": "GET", | ||
"body": "403 Forbidden", | ||
"init": { | ||
"status": 403, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### ZOD Schema | ||
[MSW JSON Config reference](./docs/README.md) | ||
|
||
### Create your own config | ||
[DEMO page](https://vkruglikov.github.io/msw-devtools-extension/) | ||
|
||
WIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# MSW JSON Config reference | ||
|
||
## JsonConfigHandler | ||
|
||
Response configuration. | ||
|
||
_Object containing the following properties:_ | ||
|
||
| Property | Description | Type | | ||
| :---------------- | :------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **`method`** (\*) | HTTP method to intercept. | `'GET' \| 'POST' \| 'PUT' \| 'DELETE' \| 'PATCH' \| 'HEAD' \| 'OPTIONS'` | | ||
| **`body`** (\*) | Response's body. Can be a string or a JSON object. | _Object with properties:_<ul></ul> _or_ `string` | | ||
| **`init`** (\*) | Response init object. | _Object with properties:_<ul><li>`headers`: _Object with properties:_<ul><li>`Content-Type`: `string`</li></ul> - Response headers.</li><li>`status`: `number` (_int, ≥100, ≤599_) - Response status code.</li></ul> | | ||
|
||
_(\*) Required._ | ||
|
||
## JsonConfig | ||
|
||
JSON configuration schema. | ||
|
||
_Object containing the following properties:_ | ||
|
||
| Property | Description | Type | | ||
| :------------------ | :--------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- | | ||
| **`version`** (\*) | Major version of the config. If it changes, the config should not be compatible with the previous version. | `1` | | ||
| **`name`** (\*) | Name of the config. This name displayed in the extension's list of configs. Should be unique per host. | `string` (_min length: 3, max length: 50_) | | ||
| **`handlers`** (\*) | List of handlers to intercept. | _Object with dynamic keys of type_ `string` _and values of type_ [JsonConfigHandler](#jsonconfighandler) | | ||
|
||
_(\*) Required._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.