7f4dbe3fd2
* remove header used for backwards compatibility in KV mounts, and use v1 paths for v1, v2 paths for v2 * make the model hook always run * simplify adapter & serializer code for secrets * update tests * fix lease tests * address review feedback
21 lines
503 B
JavaScript
21 lines
503 B
JavaScript
import Pretender from 'pretender';
|
|
|
|
const noop = response => {
|
|
return function() {
|
|
return [response, { 'Content-Type': 'application/json' }, JSON.stringify({})];
|
|
};
|
|
};
|
|
|
|
export default function(options = { usePassthrough: false }) {
|
|
return new Pretender(function() {
|
|
let fn = noop();
|
|
if (options.usePassthrough) {
|
|
fn = this.passthrough;
|
|
}
|
|
this.post('/v1/**', fn);
|
|
this.put('/v1/**', fn);
|
|
this.get('/v1/**', fn);
|
|
this.delete('/v1/**', fn || noop(204));
|
|
});
|
|
}
|