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

sync-request-curl

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sync-request-curl - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

21

dist/cjs/request.js

@@ -58,3 +58,13 @@ "use strict";

if (code !== node_libcurl_1.CurlCode.CURLE_OK) {
throw new Error(`This shouldn't happen :(. Curl request failed with code: ${code}`);
throw new Error(`
Curl request failed with code ${code}
Please look up libcurl error code!
- https://curl.se/libcurl/c/libcurl-errors.html
DEBUG: {
method: "${method}",
url: "${url}",
options: ${JSON.stringify(options)}
}
`);
}

@@ -71,3 +81,10 @@ const statusCode = curl.getInfo('RESPONSE_CODE').data;

if (statusCode >= 300) {
throw new Error(`Server responded with status code ${statusCode}\n${body.toString()}\nUse 'res.body' instead of 'res.getBody()' to not have any errors thrown.`);
throw new Error(`
Server responded with status code ${statusCode}
Body: ${body.toString()}
Use 'res.body' instead of 'res.getBody()' to not have any errors thrown.
The status code (in this case, ${statusCode}) can be checked manually with res.statusCode.
`);
}

@@ -74,0 +91,0 @@ return encoding ? body.toString(encoding) : body;

@@ -55,3 +55,13 @@ // const request = require('sync-curl');

if (code !== CurlCode.CURLE_OK) {
throw new Error(`This shouldn't happen :(. Curl request failed with code: ${code}`);
throw new Error(`
Curl request failed with code ${code}
Please look up libcurl error code!
- https://curl.se/libcurl/c/libcurl-errors.html
DEBUG: {
method: "${method}",
url: "${url}",
options: ${JSON.stringify(options)}
}
`);
}

@@ -68,3 +78,10 @@ const statusCode = curl.getInfo('RESPONSE_CODE').data;

if (statusCode >= 300) {
throw new Error(`Server responded with status code ${statusCode}\n${body.toString()}\nUse 'res.body' instead of 'res.getBody()' to not have any errors thrown.`);
throw new Error(`
Server responded with status code ${statusCode}
Body: ${body.toString()}
Use 'res.body' instead of 'res.getBody()' to not have any errors thrown.
The status code (in this case, ${statusCode}) can be checked manually with res.statusCode.
`);
}

@@ -71,0 +88,0 @@ return encoding ? body.toString(encoding) : body;

5

package.json

@@ -7,3 +7,3 @@ {

},
"version": "1.0.4",
"version": "1.1.0",
"files": [

@@ -17,3 +17,4 @@ "dist"

"build:esm": "tsc",
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
"build:cjs": "tsc --module CommonJS --outDir dist/cjs",
"prepublishOnly": "npm run build"
},

@@ -20,0 +21,0 @@ "keywords": [

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