Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mappersmith

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mappersmith - npm Package Compare versions

Comparing version 2.9.2 to 2.10.0

middlewares/csrf.js

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc