-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Shudrum/payload-size-configuration
Payload size configuration + Remove worker
- Loading branch information
Showing
7 changed files
with
113 additions
and
5 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
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,22 @@ | ||
--- | ||
layout: content | ||
title: Workers - Remove | ||
--- | ||
|
||
# filter(paths) | ||
|
||
Remove the properties listed on the `paths` argument array from the container's body | ||
|
||
_Arguments_ | ||
|
||
| Argument | Type | Description | | ||
| :------- | :------------------------- | :--------------------------------------------------- | | ||
| paths | **string** or **[string]** | **Required.** Paths or path to remove from the body. | | ||
|
||
_Example_ | ||
|
||
```js | ||
const workflow = [ | ||
remove('secret'), | ||
]; | ||
``` |
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,7 +1,7 @@ | ||
{ | ||
"name": "nodegate", | ||
"description": "API gateway made simple, fast and easy to configure.", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "Julien Martin <[email protected]>", | ||
"license": "MIT", | ||
"scripts": { | ||
|
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const remove = require('../../workers/remove'); | ||
|
||
describe('workers/remove', () => { | ||
it('should correctly return a function', () => { | ||
expect(remove()).toBeInstanceOf(Function); | ||
}); | ||
it('should remove from the container', () => { | ||
const container = { | ||
body: { | ||
ships: ['enterprise'], | ||
captains: ['Jean-Luc Picard'], | ||
}, | ||
}; | ||
remove(['ships'])(container); | ||
expect(container.body.ships).toBeFalsy(); | ||
expect(container.body.captains).toBeTruthy(); | ||
}); | ||
it('should remove from the container with the path as a string', () => { | ||
const container = { | ||
body: { | ||
ships: ['enterprise'], | ||
captains: ['Jean-Luc Picard'], | ||
}, | ||
}; | ||
remove('ships')(container); | ||
expect(container.body.ships).toBeFalsy(); | ||
expect(container.body.captains).toBeTruthy(); | ||
}); | ||
it('should remove from the container body only', () => { | ||
const container = { | ||
params: { | ||
organization: 'Federation', | ||
}, | ||
body: { | ||
ships: ['enterprise'], | ||
captains: ['Jean-Luc Picard'], | ||
}, | ||
}; | ||
remove(['ships'])(container); | ||
expect(container.params.organization).toBeTruthy(); | ||
expect(container.body.captains).toBeTruthy(); | ||
}); | ||
it('should remove nested values from the container', () => { | ||
const container = { | ||
body: { | ||
ships: ['enterprise', 'NC-1701'], | ||
captains: ['Jean-Luc Picard'], | ||
}, | ||
}; | ||
remove(['ships[1]'])(container); | ||
expect(container.body.ships).toBeTruthy(); | ||
expect(container.body.ships[1]).toBeUndefined(); | ||
}); | ||
}); |
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,12 @@ | ||
/** | ||
* Copyright (c) Weekendesk SAS. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const { omit } = require('lodash'); | ||
|
||
module.exports = (paths) => (container) => { | ||
container.body = omit(container.body, paths); | ||
}; |