mappersmith
Advanced tools
Comparing version 2.9.2 to 2.10.0
{ | ||
"name": "mappersmith", | ||
"version": "2.9.2", | ||
"version": "2.10.0", | ||
"description": "It is a lightweight rest client for node.js and the browser", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
@@ -520,2 +520,18 @@ [![npm version](https://badge.fury.io/js/mappersmith.svg)](http://badge.fury.io/js/mappersmith) | ||
#### <a name="csrf-middleware"></a> Csrf | ||
Automatically configure your requests by adding a header with the value of a cookie - If it exists. | ||
The name of the cookie (defaults to "csrfToken") and the header (defaults to "x-csrf-token") can be set as following; | ||
```javascript | ||
import Csrf from 'mappersmith/middlewares/csrf' | ||
const client = forge({ | ||
middlewares: [ Csrf('csrfToken', 'x-csrf-token') ], | ||
/* ... */ | ||
}) | ||
client.User.all() | ||
``` | ||
## <a name="testing-mappersmith"></a> Testing Mappersmith | ||
@@ -607,3 +623,3 @@ | ||
It's possible to use a match function to assert the body, example: | ||
It's possible to use a match function to assert params and body, example: | ||
@@ -616,2 +632,3 @@ ```javascript | ||
id: 'abc', | ||
name: m.stringContaining('john'), | ||
headers: { 'x-special': 'value'}, | ||
@@ -724,3 +741,3 @@ body: m.stringMatching(/token=[^&]+&other=true$/) | ||
`mockClient` and `mockRequest` accept a match function for body, the available Built-in match functions are: | ||
`mockClient` and `mockRequest` accept match functions, the available built-in match functions are: | ||
@@ -746,2 +763,6 @@ ```javascript | ||
__Note__: | ||
`mockClient` only accepts match functions for __body__ and __params__ | ||
`mockRequest` only accepts match functions for __body__ and __url__ | ||
## <a name="gateways"></a> Gateways | ||
@@ -748,0 +769,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88624
29
1754
879