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

restl

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restl - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

lib/http-error.js

6

changelog.md
ChangeLog
=========
0.4.1 (2017-07-07)
------------------
* #38: Add HTTP response to HTTP-related exceptions.
0.4.0 (2017-07-07)

@@ -5,0 +11,0 @@ ------------------

9

lib/resource.js

@@ -8,2 +8,3 @@ 'use strict';

var fetch = require('node-fetch');
var HttpError = require('./http-error');

@@ -46,3 +47,3 @@ var Resource = function(client, uri) {

if (!response.ok) {
throw new Error('HTTP error: ' + response.status);
throw new HttpError(response);
}

@@ -71,3 +72,3 @@

if (!response.ok) {
throw new Error('HTTP error: ' + response.status);
throw new HttpError(response);
}

@@ -107,3 +108,3 @@

if (!response.ok) {
throw new Error('HTTP error: ' + response.status);
throw new HttpError(response);
}

@@ -136,3 +137,3 @@

if (!response.ok) {
throw new Error('HTTP error: ' + response.status);
throw new HttpError(response);
} else {

@@ -139,0 +140,0 @@ return response.json();

{
"name": "restl",
"version": "0.4.0",
"version": "0.4.1",
"description": "Opiniated HAL client.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -32,2 +32,15 @@ const Client = require('../../lib/client');

it('should throw an exception when there was a HTTP error', async() => {
const resource = await client.follow('error400');
let exception;
try {
await resource.get();
} catch (ex) {
exception = ex;
}
expect(exception.response.status).to.equal(400);
});
});
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