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

@totvs/http

Package Overview
Dependencies
Maintainers
24
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@totvs/http - npm Package Compare versions

Comparing version 0.0.1-20210315.1 to 0.0.1-20210413.1

100

http/http.plugin.test.js

@@ -44,3 +44,6 @@ "use strict";

var expectedHeadersReturn = { Authorization: 'Bearer delete' };
httpPlugin.delete('/test', 'name=test-delete', expectedHeadersReturn).toPromise()
var body = {
'name': 'test-delete'
};
httpPlugin.delete('/test', body, expectedHeadersReturn).toPromise()
.catch(function (e) {

@@ -53,3 +56,6 @@ expect(e).toBeTruthy();

var expectedHeadersReturn = { Authorization: 'Bearer get' };
httpPlugin.get('/test', 'name=test-get', expectedHeadersReturn)
var body = {
'name': 'test-get'
};
httpPlugin.get('/test', body, expectedHeadersReturn)
.toPromise()

@@ -63,3 +69,6 @@ .catch(function (e) {

var expectedHeadersReturn = { Authorization: 'Bearer patch' };
httpPlugin.patch('/test', { type: 'patch' }, 'name=test-patch', expectedHeadersReturn)
var body = {
'name': 'test-patch'
};
httpPlugin.patch('/test', { type: 'patch' }, body, expectedHeadersReturn)
.toPromise()

@@ -73,3 +82,6 @@ .catch(function (e) {

var expectedHeadersReturn = { Authorization: 'Bearer post' };
httpPlugin.post('/test', { type: 'post' }, 'name=test-post', expectedHeadersReturn)
var body = {
'name': 'test-post'
};
httpPlugin.post('/test', { type: 'post' }, body, expectedHeadersReturn)
.toPromise()

@@ -83,3 +95,6 @@ .catch(function (e) {

var expectedHeadersReturn = { Authorization: 'Bearer put' };
httpPlugin.put('/test', { type: 'put' }, 'name=test-post', expectedHeadersReturn)
var body = {
'name': 'test-post'
};
httpPlugin.put('/test', { type: 'put' }, body, expectedHeadersReturn)
.toPromise()

@@ -93,13 +108,22 @@ .catch(function (e) {

var httpDeleteSpyEvent = jest.spyOn(httpPlugin['http'], 'delete');
httpPlugin.delete(undefined, 'name=test-delete');
expect(httpDeleteSpyEvent).toHaveBeenCalledWith('', 'name=test-delete');
var body = {
'name': 'test-delete'
};
httpPlugin.delete(undefined, body);
expect(httpDeleteSpyEvent).toHaveBeenCalledWith('', body);
});
test('get: should call `http.get` with empty url.', function () {
var httpGetSpyEvent = jest.spyOn(httpPlugin['http'], 'get');
httpPlugin.get(undefined, 'name=test-get');
expect(httpGetSpyEvent).toHaveBeenCalledWith('', 'name=test-get');
var body = {
'name': 'test-get'
};
httpPlugin.get(undefined, body);
expect(httpGetSpyEvent).toHaveBeenCalledWith('', body);
});
test('put: should call `http.put` with empty url.', function () {
var httpPutSpyEvent = jest.spyOn(httpPlugin['http'], 'put');
httpPlugin.put(undefined, {}, 'name=test-put');
var body = {
'name': 'test-put'
};
httpPlugin.put(undefined, {}, body);
expect(httpPutSpyEvent).toHaveBeenCalled();

@@ -109,3 +133,6 @@ });

var httpPatchSpyEvent = jest.spyOn(httpPlugin['http'], 'patch');
httpPlugin.patch(undefined, {}, 'name=test-patch');
var body = {
'name': 'test-patch'
};
httpPlugin.patch(undefined, {}, body);
expect(httpPatchSpyEvent).toHaveBeenCalled();

@@ -115,3 +142,6 @@ });

var httpPostSpyEvent = jest.spyOn(httpPlugin['http'], 'post');
httpPlugin.post(undefined, {}, 'name=test-post');
var body = {
'name': 'test-post'
};
httpPlugin.post(undefined, {}, body);
expect(httpPostSpyEvent).toHaveBeenCalled();

@@ -121,12 +151,18 @@ });

var httpHeadSpyEvent = jest.spyOn(httpPlugin['http'], 'head');
httpPlugin.head(undefined, 'name=test-head');
expect(httpHeadSpyEvent).toHaveBeenCalledWith('', 'name=test-head');
var body = {
'name': 'test-head'
};
httpPlugin.head(undefined, body);
expect(httpHeadSpyEvent).toHaveBeenCalledWith('', body);
});
describe('request:', function () {
test('get: should call `http.get` with header.', function () { return __awaiter(void 0, void 0, void 0, function () {
var httpGetSpyEvent, header;
var httpGetSpyEvent, body, header;
return __generator(this, function (_a) {
httpGetSpyEvent = jest.spyOn(httpPlugin, 'get');
body = {
'name': 'test-request-get'
};
header = { Authorization: 'Bearer get' };
httpPlugin.request('GET', '/test-request-get', {}, 'name=test-request-get', header)
httpPlugin.request('GET', '/test-request-get', {}, body, header)
.toPromise()

@@ -141,6 +177,9 @@ .catch(function (e) {

test('get: should call `http.head`.', function () { return __awaiter(void 0, void 0, void 0, function () {
var httpGetSpyEvent;
var httpGetSpyEvent, body;
return __generator(this, function (_a) {
httpGetSpyEvent = jest.spyOn(httpPlugin, 'head');
httpPlugin.request('HEAD', '/test-request-head', {}, 'name=test-request-get');
body = {
'name': 'test-request-get'
};
httpPlugin.request('HEAD', '/test-request-head', {}, body);
expect(httpGetSpyEvent).toHaveBeenCalled();

@@ -152,3 +191,6 @@ return [2 /*return*/];

var httpGetSpyEvent = jest.spyOn(httpPlugin, 'get');
httpPlugin.request('GET', '/test-request-get', {}, 'name=test-request-get').toPromise()
var body = {
'name': 'test-request-get'
};
httpPlugin.request('GET', '/test-request-get', {}, body).toPromise()
.catch(function (e) {

@@ -161,4 +203,7 @@ expect(e).toBeTruthy();

var httpPostSpyEvent = jest.spyOn(httpPlugin, 'post');
var body = {
'name': 'test-request-post'
};
var header = { Authorization: 'Bearer post' };
httpPlugin.request('POST', '/test-request-post', {}, 'name=test-request-post', header)
httpPlugin.request('POST', '/test-request-post', {}, body, header)
.toPromise()

@@ -172,4 +217,7 @@ .catch(function (e) {

var httpPutSpyEvent = jest.spyOn(httpPlugin, 'put');
var body = {
'name': 'test-request-put'
};
var header = { Authorization: 'Bearer put' };
httpPlugin.request('PUT', '/test-request-put', {}, 'name=test-request-put', header)
httpPlugin.request('PUT', '/test-request-put', {}, body, header)
.toPromise()

@@ -183,4 +231,7 @@ .catch(function (e) {

var httpPatchSpyEvent = jest.spyOn(httpPlugin, 'patch');
var body = {
'name': 'test-request-patch'
};
var header = { Authorization: 'Bearer patch' };
httpPlugin.request('PATCH', '/test-request-patch', {}, 'name=test-request-patch', header)
httpPlugin.request('PATCH', '/test-request-patch', {}, body, header)
.toPromise()

@@ -194,4 +245,7 @@ .catch(function (e) {

var httpDeleteSpyEvent = jest.spyOn(httpPlugin, 'delete');
var body = {
'name': 'test-request-delete'
};
var header = { Authorization: 'Bearer delete' };
httpPlugin.request('DELETE', '/test-request-delete', {}, 'name=test-request-delete', header)
httpPlugin.request('DELETE', '/test-request-delete', {}, body, header)
.toPromise()

@@ -198,0 +252,0 @@ .catch(function (e) {

{
"name": "@totvs/http",
"version": " 0.0.1-20210315.1",
"version": " 0.0.1-20210413.1",
"description": "Http client",

@@ -44,5 +44,5 @@ "author": "TOTVS SA",

"dependencies": {
"axios": "0.18.0",
"axios": "0.21.1",
"rxjs": "^6.6.3"
}
}

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