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

@wix/be-http-binding

Package Overview
Dependencies
Maintainers
4
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/be-http-binding - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

19

lib/http-binding.js

@@ -9,6 +9,6 @@

function http(binding, requestMessage, responseMessage, methodOptions) {
function http(binding, requestMessage, responseMessage, methodOptions = {}) {
return {
async invoke(message, options) {
const result = await binding.invokeWith(methodOptions.invoker || options.invoker, requestMessage.fromValue(message));
async invoke(message, options = {}) {
const result = await binding.invoke(requestMessage.fromValue(message), mergeOptions(methodOptions, options));

@@ -18,2 +18,9 @@ return responseMessage.fromValue(result);

};
function mergeOptions(a, b) {
return {
...a,
...b
};
}
}

@@ -39,3 +46,4 @@

return {
async invokeWith(invoker, rawMessage) {
async invoke(rawMessage, options) {
const invoker = options.invoker;
const {uri, message} = getUriAndMessage(rawMessage);

@@ -45,3 +53,4 @@

method,
uri
uri,
options
};

@@ -48,0 +57,0 @@

@@ -36,3 +36,4 @@ const {http, get, post, put} = require('./http-binding');

method: 'get',
uri: '/pass?a=1'
uri: '/pass?a=1',
message: undefined
});

@@ -88,11 +89,37 @@ });

it('should pass options to invoker', async() => {
const givenMethod = http(get('/pass'), message, message, {invoker, methodOption: 'a'});
await givenMethod.invoke({
a: 1,
b: 2
}, {
invocationOption: 'b'
});
const lastOptions = invoker.lastOptions();
expect(lastOptions.methodOption).to.equal('a');
expect(lastOptions.invocationOption).to.equal('b');
});
function testInvoker(fn) {
const invocations = [];
let lastOptions;
return {
invoke(request) {
invocations.push(request);
invoke(request) {
invocations.push({
method: request.method,
uri: request.uri,
message: request.message
});
lastOptions = request.options;
return fn(request);
},
lastOptions() {
return lastOptions;
},
invocations() {

@@ -99,0 +126,0 @@ return invocations;

{
"name": "@wix/be-http-binding",
"version": "1.0.9",
"version": "1.0.10",
"author": "Mantas Indrašius <mantasi@wix.com>",

@@ -5,0 +5,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

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