
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
@synapsestudios/goalie
Advanced tools
Goalie is a hapi plugin that monitors requests for an api-version header and will return a 412 instead of running handlers when a version mismatch is detected.
Goalie will append an api-version
header to all of your api responses. In addition, it will monitor incoming response headers for an api-version
header. If the client provides an api version that is incompatible with the current api version then the request will be aborted and a 412 response will be returned. In this way you can prevent the api from attempting to run known incompatible requests.
npm i @synapsestudios/goalie --save
Add goalie as a plugin to your hapi server:
const Hapi = require('hapi');
const Goalie = require('../lib');
const server = new Hapi.Server();
await server.register({
register: Goalie,
{ apiVersion: 'v1.0.0' },
});
By default goalie uses the npm semver module to determine version compatibility. If your request api-version
is "^v1.0.0" and the api's actual version is "v1.0.2" then goalie will not abort that request. In addition to semver, you can use 'strict' mode which uses strict equality to determine if versions match (requestVersion === apiVersion), or you can provide a callback to resolve version compatibility yourslef.
// use strict
await server.register({
register: Goalie,
{
apiVersion: 'v1.0.0',
compatibilityMethod: 'strict',
}
});
// or use a callback
await server.register({
register: Goalie,
{
apiVersion: 'v1.0.0',
compatibilityMethod: (requestVersion, apiVersion) => {
// determine whether or not the request version is compatible
return true; // return false to abort the request and return 412
},
}
});
name | description |
---|---|
apiVersion | The current version of the api |
compatibilityMethod | The method that goalie will use to determine version compatibility. Defaults to 'semver' |
FAQs
Goalie is a hapi plugin that monitors requests for an api-version header and will return a 412 instead of running handlers when a version mismatch is detected.
The npm package @synapsestudios/goalie receives a total of 103 weekly downloads. As such, @synapsestudios/goalie popularity was classified as not popular.
We found that @synapsestudios/goalie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.