Releases: ybonnefond/stubborn
Releases · ybonnefond/stubborn
v5.0.4
v5.0.3
v5.0.2
v5.0.1
v5.0.0
BREAKING CHANGE
Null and undefined are not anymore converted to empty strings when applying a response template
For JSON responses body they will now follow the behavior of JSON.stringify
v3.0.1
Fixes
- Fix rendering of object in diff log
v3.0.0
BREAKING CHANGES
Wildcarding
Null has been replaced by the constant WILDCARD
Before:
sb.get('/').setHeaders(null);
After:
import {WILDCARD} from 'stubborn-ws';
sb.get('/').setHeaders(WILDCARD);
Types changes
Some types has been renamed:
RequestDefinition
=> DefinitionValue
RequestBodyDefinition*
=> BodyDefinition*
Not Implemented event
The request is not directly passed to the event handler anymore
Before:
import {EVENTS} from 'stubborn-ws';
sb.on(EVENTS.NOT_IMPLEMENTED, (req) => console.log(req.path))
After:
import {EVENTS} from 'stubborn-ws';
sb.on(EVENTS.NOT_IMPLEMENTED, (dbg) => console.log(dbg.getInfo().path))
Features
Wildcarding
The WILDCARD constant is replacing null
to wildcard path, headers, query parameters or body
import {WILDCARD} from 'stubborn-ws';
sb.get('/').setHeaders(WILDCARD);
Log differences between a request and a route
A function has been added to log differences between a route an any request returning a 501.
import {logDiffOn501} from 'stubborn-ws';
const route = sb.get('/').setHeaders(WILDCARD);
// Add this to figure out why the request is not matching
logDiffOn501(sb, route);
await request('/invalid-path');
// => diff output on stdout
Cleared event
A cleared event is emitted when sb.clear() is called
import { EVENTS } from 'stubborn-ws';
sb.on(EVENTS.CLEARED, ()=> console.log('Cleared!'));
sb.clear();
v2.2.1
Feat
Not implemented event
An event is emitted when a request does not match any routes
import {EVENTS} from 'stubborn-ws';
sb.on(EVENTS.NOT_IMPLEMENTED, (req) => console.log(req.path) );
v2.2.0
Features
- Emit event on "Not Implemented" error with request info to help debugging
v2.1.0
Features
- Directly Register Route instance