Comparing version 0.2.3 to 0.2.4
## 0.2.x | ||
### 0.2.4 | ||
Bug fix - resources with custom urlPrefixes did not get hypermedia middleware | ||
### 0.2.3 | ||
@@ -4,0 +7,0 @@ |
{ | ||
"name": "hyped", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Hypermedia response generation engine", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -341,3 +341,4 @@ ## hyped | ||
// callback gets invoked once all resources are loaded | ||
// this is largely to support test setups | ||
// this is where you should call start on the host variable | ||
host.start(); | ||
} ); | ||
@@ -344,0 +345,0 @@ ``` |
@@ -38,2 +38,3 @@ var _ = require( "lodash" ); | ||
].join( "" ).replace( "//", "/" ); | ||
host.http.middleware( prefixUrl, state.optionsMiddleware, "options" ); | ||
@@ -44,2 +45,13 @@ host.http.middleware( prefixUrl, state.hyperMiddleware, "hyped" ); | ||
function addResourceMiddleware( state, host ) { | ||
var resourcePrefixes = _.filter( _.unique( _.pluck( _.values( state.resources ), "urlPrefix" ) ) ); | ||
_.each( resourcePrefixes, function( resourcePrefix ) { | ||
var resourcePrefixUrl = [ | ||
resourcePrefix, | ||
state.prefix.apiPrefix | ||
].join( "" ).replace( "//", "/" ); | ||
host.http.middleware( resourcePrefixUrl, state.hyperMiddleware, "hyped" ); | ||
} ); | ||
} | ||
function addResource( state, resource, resourceName ) { // jshint ignore:line | ||
@@ -67,2 +79,3 @@ state.resources[ resourceName ] = resource; | ||
state.addResources( resources ); | ||
addResourceMiddleware( state, host ); | ||
subscription.unsubscribe(); | ||
@@ -69,0 +82,0 @@ if ( done ) { |
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
157748
3606
637