Skip to content

Commit 851a547

Browse files
committed
renamed jsonmw to json, throwermw to thrower, in metro.mw
1 parent 0a3e744 commit 851a547

File tree

12 files changed

+24
-24
lines changed

12 files changed

+24
-24
lines changed

dist/everything.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/everything.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/everything.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/everything.min.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const client = metro.client({
1414
headers: {
1515
'Authorization':'Bearer '+token
1616
}
17-
}).with(metro.mw.jsonmw())
17+
}).with(metro.mw.json())
1818

1919
let response = await client.get('/repos/muze-nl/metro/commits')
2020

docs/middleware/getdata.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ The `getdatamw()` middleware will automatically return response.data instead of
1111
import metro from '@muze-nl/metro'
1212

1313
const client = metro.client().with(
14-
metro.mw.jsonmw(),
15-
metro.mw.throwermw(),
16-
metro.mw.getdatamw()
14+
metro.mw.json(),
15+
metro.mw.thrower(),
16+
metro.mw.getdata()
1717
)
1818
```
1919

docs/middleware/json.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ title: 'JSON middleware'
33
---
44
# JSON middleware
55

6-
The `jsonmw()` middleware allows you to automatically parse and stringify javascript data when sending or receiving data.
6+
The `json` middleware allows you to automatically parse and stringify javascript data when sending or receiving data.
77

88
## Usage
99

1010
```javascript
1111
import metro from '@muze-nl/metro'
1212

13-
const client = metro.client().with( metro.mw.jsonmw({
13+
const client = metro.client().with( metro.mw.json({
1414
space: "\t"
1515
}) )
1616
```
@@ -27,7 +27,7 @@ if (response.ok) {
2727
}
2828
```
2929

30-
The `jsonmw` middelware will automatically add the `Accept: application/json` header to your requests.
30+
The `json` middelware will automatically add the `Accept: application/json` header to your requests.
3131

3232
If the HTTP request supports a body, as in `POST`, `PUT`, `PATCH` and `QUERY`, it will also add the `Content-Type: application/json` header. Any data send as the body of the request, will be turned into json.
3333

docs/middleware/thrower.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ title: 'Thrower middleware'
33
---
44
# Thrower middleware
55

6-
The `throwermw()` middleware will throw Errors when a response returns with a status in the 400 to 599 tange.
6+
The `thrower` middleware will throw Errors when a response returns with a status in the 400 to 599 tange.
77

88
## Usage
99

1010
```javascript
1111
import metro from '@muze-nl/metro'
1212

13-
const client = metro.client().with( mtro.mw.throwermw() )
13+
const client = metro.client().with( metro.mw.thrower() )
1414

1515
try {
1616
let response = await client.get('https://example.com/404/')
@@ -25,7 +25,7 @@ try {
2525
You can set custom handling for specific status codes, like this:
2626

2727
```javascript
28-
const client = metro.client().with( throwermw({
28+
const client = metro.client().with( metro.mw.thrower({
2929
404: (req) => {
3030
return client.get(req.with({
3131
url: 'https://example.com/'

docs/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you are using a cdn, and need the assert library or one of the default middle
2828
```html
2929
<script src="https://cdn.jsdelivr.net/npm/@muze-nl/metro/dist/everything.js"></script>
3030
<script>
31-
const client = metro.client(metro.mw.jsonmw())
31+
const client = metro.client(metro.mw.json())
3232
</script>
3333
```
3434

docs/tutorials.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This gives access to everything included in metro, like the json and thrower mid
2121

2222
```javascript
2323
import * as metro from '@muze-nl/metro/src/metro.mjs'
24-
import jsonmw from '@muze-nl/metro/mw/json.mjs'
24+
import json from '@muze-nl/metro/mw/json.mjs'
2525
```
2626

2727
Or you can use a CDN (Content Delivery Network), like this:
@@ -141,7 +141,7 @@ async function postData(data) {
141141

142142
## JSON middleware
143143

144-
The jsonmw middleware automatically converts data to json, adds the correct headers, and parses responses.
144+
The json middleware automatically converts data to json, adds the correct headers, and parses responses.
145145
The response body, if parseable as json, is made available as `response.data`
146146

147147
```javascript

0 commit comments

Comments
 (0)