New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

syncano-server

Package Overview
Dependencies
Maintainers
2
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

syncano-server - npm Package Compare versions

Comparing version 0.7.2-25 to 0.7.2-26

.nyc_output/633bac96b6e51e58200d1e9f44040199.json

3

lib/endpoint.js

@@ -59,3 +59,4 @@ 'use strict';

var fetch = this.localFetch.bind(this);
var fetch = this.fetch.bind(this);
return fetch(this.url(endpoint), _extends({

@@ -62,0 +63,0 @@ method: 'POST',

@@ -41,12 +41,2 @@ 'use strict';

}, {
key: 'localFetch',
value: function localFetch(url, options) {
return (0, _nodeFetch2.default)(url, _extends({
headers: {
'Content-Type': 'application/json',
'X-API-KEY': this.instance.token
}
}, options)).then(_utils.checkStatus);
}
}, {
key: 'nonInstanceFetch',

@@ -53,0 +43,0 @@ value: function nonInstanceFetch(url, options, headers) {

@@ -26,6 +26,19 @@ 'use strict';

function parseJSON(response) {
if (response.status === 202) {
var mimetype = response.headers.get('Content-Type');
if (response.status === 204 || mimetype === null) {
return Promise.resolve();
}
return response.json();
// Parse JSON
if (/^.*\/.*\+json/.test(mimetype) || /^application\/json/.test(mimetype)) {
return response.json();
}
// Parse XML and plain text
if (/^text\/.*/.test(mimetype) || /^.*\/.*\+xml/.test(mimetype) || mimetype === 'text/plain') {
return response.text();
}
return response.arraybuffer();
}

@@ -32,0 +45,0 @@

{
"name": "syncano-server",
"version": "0.7.2-25",
"version": "0.7.2-26",
"description": "A library to intereact with the Syncano API on a server side",

@@ -26,3 +26,3 @@ "main": "lib/index.js",

"lint": "xo src/**/*.js test/**/*.js",
"e2e": "mkdir e2e-tests || 1 && cross-env NODE_ENV=test mocha tests/e2e/*.js --reporter spec --require babel-register --timeout 30000 --slow 8000",
"e2e": "mkdir e2e-tests || true && cross-env NODE_ENV=test mocha tests/e2e/*.js --reporter spec --require babel-register --timeout 30000 --slow 8000",
"watch": "npm-run-all --parallel watch:*",

@@ -43,3 +43,3 @@ "watch:lib": "npm run build:lib -- --watch",

"dependencies": {
"node-fetch": "^1.6.3"
"node-fetch": "2.0.0-alpha.3"
},

@@ -46,0 +46,0 @@ "devDependencies": {

@@ -19,3 +19,4 @@ import QueryBuilder from './query-builder'

client(endpoint, body = {}, options = {}) {
const fetch = this.localFetch.bind(this)
const fetch = this.fetch.bind(this)
return fetch(this.url(endpoint), {

@@ -22,0 +23,0 @@ method: 'POST',

@@ -22,13 +22,2 @@ import nodeFetch from 'node-fetch'

localFetch(url, options) {
return nodeFetch(url, {
headers: {
'Content-Type': 'application/json',
'X-API-KEY': this.instance.token
},
...options
})
.then(checkStatus)
}
nonInstanceFetch(url, options, headers) {

@@ -35,0 +24,0 @@ return nodeFetch(url, {

@@ -16,6 +16,26 @@ import {getHost, SYNCANO_API_VERSION} from './settings'

export function parseJSON(response) {
if (response.status === 202) {
const mimetype = response.headers.get('Content-Type')
if (response.status === 204 || mimetype === null) {
return Promise.resolve()
}
return response.json()
// Parse JSON
if (
/^.*\/.*\+json/.test(mimetype) ||
/^application\/json/.test(mimetype)
) {
return response.json()
}
// Parse XML and plain text
if (
/^text\/.*/.test(mimetype) ||
/^.*\/.*\+xml/.test(mimetype) ||
mimetype === 'text/plain'
) {
return response.text()
}
return response.arraybuffer()
}

@@ -22,0 +42,0 @@

Sorry, the diff of this file is not supported yet

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