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.1 to 0.4.2

8

changelog.md
ChangeLog
=========
0.4.2 (2017-08-03)
------------------
* #39: Making it easier to fire off custom HTTP requests on a resource using
the Fetch API. You can now just provide the `init` argument without providing
a url.
0.4.1 (2017-07-07)

@@ -5,0 +13,0 @@ ------------------

17

lib/resource.js

@@ -256,7 +256,22 @@ 'use strict';

if (typeof input === 'undefined') {
// Nothing was provided, we're operating on the resource uri
input = this.uri;
} else if (typeof input === 'string') {
// A uri as sting is provided, we're resolving it.
input = url.resolve(this.uri, input);
} else if (typeof input.url === 'string') {
// A url is provided in the init object.
input.url = url.resolve(this.uri, input.url);
} else {
input.url = url.resolve(this.uri, input.url);
// The provided argument is untyped, so likely the init
// parameter was put first.
// Using the argument as the 'init' value
init = input;
// And using the current uri as the 'input' value.
input = this.uri;
}

@@ -263,0 +278,0 @@ var request = new fetch.Request(input, init);

2

package.json
{
"name": "restl",
"version": "0.4.1",
"version": "0.4.2",
"description": "Opiniated HAL client.",

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

@@ -9,4 +9,5 @@ const Client = require('../../lib/client');

let hal2;
let client;
before( async () => {
const client = new Client('http://localhost:3000/hal1.json');
client = new Client('http://localhost:3000/hal1.json');
hal2 = await client.follow('next');

@@ -16,3 +17,3 @@ });

it('should return a response object', async() => {
const response = await hal2.fetch('?foo=bar');

@@ -25,4 +26,4 @@ expect(response).to.have.property('status');

it('should also work when passing a Request object', async() => {
const request = new Request('?foo=bar');
const request = new Request('?foo=bar');
const response = await hal2.fetch(request);

@@ -34,2 +35,16 @@ expect(response).to.have.property('status');

it('should allow overriding the HTTP method', async() => {
const response = await hal2.fetch({ method: 'PUT' });
expect(response).to.have.property('status');
expect(response.status).to.eql(204);
});
after( async() => {
// Clearing any changes.
await client.getResource('/reset').post({});
});
});
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