mockaton 8.2.6 → 8.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -124,10 +124,14 @@ export default [
124
124
  **Option B:** Function
125
125
 
126
126
  Think of this as an HTTP handler. You can read or write to a
127
- database, or pull data from a backend.
127
+ database, or pull data from a backend. Also, you can modify the
128
+ response object, e.g. for changing the status code and mime.
128
129
 
129
130
  Don’t call `response.end()`, just return a `string | Buffer | Uint8Array`.
130
131
 
132
+ If you need to serve a static `.js` file, put it in your
133
+ `Config.staticDir` without the mock filename convention.
134
+
131
135
  ```js
132
136
  export default function requestCounter(request, response) {
133
137
  globalThis.myDatabase ??= { count: 0 }
@@ -138,11 +142,8 @@ export default function requestCounter(request, response) {
138
142
  }
139
143
  ```
140
144
 
141
- If you need to serve a static `.js` file, put it in your
142
- `Config.staticDir` without the mock filename convention.
143
-
145
+ This example will echo the request body concatenated with another fixture.
144
146
  ```js
145
- // This example will echo the request body concatenated with another fixture.
146
147
  // api/color.POST.201.js
147
148
 
148
149
  import colors from './colors.json' with { type: 'json' }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "A deterministic server-side for developing and testing frontend clients",
4
4
  "type": "module",
5
- "version": "8.2.6",
5
+ "version": "8.2.7",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "license": "MIT",