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

hyped

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyped - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

spec/integration/halOptionsMore.json

4

CHANGELOG.md
## 0.4.x
### 0.4.4
* Fixed issue where OPTIONS call was cached in memory on first request and cached result was used from then on.
### 0.4.3

@@ -4,0 +8,0 @@ * Bug fix - jsonEngine was turning strings in arrays into objects

{
"name": "hyped",
"version": "0.4.3",
"version": "0.4.4",
"description": "Hypermedia response generation engine",

@@ -42,2 +42,10 @@ "main": "src/index.js",

"url": "http://nerdventure.io"
},
{
"name": "Doug Neiner",
"url": "http://dougneiner.com"
},
{
"name": "Jim Cowart",
"url": "http://ifandelse.com"
}

@@ -44,0 +52,0 @@ ],

@@ -23,2 +23,13 @@ module.exports = function() {

}
},
sometimesShow: {
method: "get",
url: "/more",
actions: [],
authorize: function( envelope ) {
return envelope._original.req.headers.hasOwnProperty( "x-show-me-more" );
},
handle: function( envelope ) {
return { data: envelope.context };
}
}

@@ -25,0 +36,0 @@ }

@@ -269,2 +269,39 @@ require( "../setup" );

describe( "when hitting root with options verb and the options change between requests", function() {
var body, contentType, secondBody, secondContentType;
var expectedOptions = require( "./halOptions.json" );
var moreExpectedOptions = require( "./halOptionsMore.json" );
before( function( done ) {
request( { method: "OPTIONS", url: "http://localhost:8800/test/api" }, function( err, res ) {
body = res.body;
contentType = res.headers[ "content-type" ].split( ";" )[ 0 ];
request( {
method: "OPTIONS",
url: "http://localhost:8800/test/api",
headers: { "x-show-me-more": "true" }
}, function( err, res ) {
secondBody = res.body;
secondContentType = res.headers[ "content-type" ].split( ";" )[ 0 ];
done();
} );
} );
} );
it( "should get options", function() {
contentType.should.equal( "application/json" );
var json = JSON.parse( body );
delete json._links[ "ah:metrics" ];
json.should.eql( expectedOptions );
} );
it( "should get the additional link on the second call", function() {
secondContentType.should.equal( "application/json" );
var json = JSON.parse( secondBody );
delete json._links[ "ah:metrics" ];
json.should.eql( moreExpectedOptions );
} );
} );
after( function() {

@@ -271,0 +308,0 @@ host.stop();

6

src/index.js

@@ -120,6 +120,3 @@ var _ = require( "lodash" );

}
if ( !state.optionModels[ version ] ) {
state.optionModels[ version ] = HyperResource.optionsGenerator( state.resources, state.prefix, version, state.excludeChildren, envelope )( state.engines );
}
return state.optionModels[ version ];
return HyperResource.optionsGenerator( state.resources, state.prefix, version, state.excludeChildren, envelope )( state.engines );
}

@@ -211,3 +208,2 @@

resources: {},
optionModels: {},
fullOptionModels: {},

@@ -214,0 +210,0 @@ prefix: undefined,

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