Comparing version 0.4.3 to 0.4.4
## 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(); |
@@ -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, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
189477
50
4470