How to use the @hapi/hoek.block function in @hapi/hoek

To help you get started, we’ve selected a few @hapi/hoek examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hapijs / hapi / test / request.js View on Github external
it('returns a logged bad request error when parser fails after request is setup (cleanStop false)', async () => {

            const server = Hapi.server({ routes: { timeout: { server: false } }, operations: { cleanStop: false } });
            server.route({ path: '/', method: 'GET', handler: Hoek.block });
            await server.start();

            const client = Net.connect(server.info.port);
            const clientEnded = new Promise((resolve, reject) => {

                let response = '';
                client.on('data', (chunk) => {

                    response = response + chunk.toString();
                });

                client.on('end', () => resolve(response));
                client.on('error', reject);
            });

            await new Promise((resolve) => client.on('connect', resolve));
github hapijs / hapi / test / payload.js View on Github external
it('errors saving a file without parse', async () => {

        const server = Hapi.server();
        server.route({ method: 'POST', path: '/file', options: { handler: Hoek.block, payload: { output: 'file', parse: false, uploads: '/a/b/c/d/not' } } });
        const res = await server.inject({ method: 'POST', url: '/file', payload: 'abcde' });
        expect(res.statusCode).to.equal(500);
    });
github hapijs / hapi / test / request.js View on Github external
it('returns a logged bad request error when parser fails after request is setup', async () => {

            const server = Hapi.server({ routes: { timeout: { server: false } } });
            server.route({ path: '/', method: 'GET', handler: Hoek.block });
            await server.start();

            const log = server.events.once('response');
            const client = Net.connect(server.info.port);
            const clientEnded = new Promise((resolve, reject) => {

                let response = '';
                client.on('data', (chunk) => {

                    response = response + chunk.toString();
                });

                client.on('end', () => resolve(response));
                client.on('error', reject);
            });
github hapijs / hapi / test / request.js View on Github external
const ext = (request) => {

                return Hoek.block();
            };
github hapijs / hapi / test / core.js View on Github external
const preStop = function (srv) {

                return Hoek.block();
            };
github hapijs / catbox / test / policy.js View on Github external
generateFunc: async function (id) {

                        await Hoek.block();
                    }
                };