nes
nes copied to clipboard
Error is thrown, if client.connect({auth: 'somestring'})
Support plan
- is this issue currently blocking your project? (yes/no):
- is this issue affecting a production system? (yes/no):
Context
- node version: 16
- module version with issue: 13.0.0
- last module version without issue:
- environment (e.g. node, browser, native): node
- used with (e.g. hapi application, another framework, standalone, ...): hapi
- any other relevant information:
What are you trying to achieve or the steps to reproduce?
Dear all, just found out that the server code crashes if the auth variable on the client side is not an object, e.g. a string. Client values should be validated first.
describe('direct', () => {
it('protects an endpoint', async () => {
const server = Hapi.server();
server.auth.scheme('custom', internals.implementation);
server.auth.strategy('default', 'custom');
server.auth.default('default');
await server.register(Nes);
server.route({
method: 'GET',
path: '/',
handler: () => 'hello'
});
await server.start();
const client = new Nes.Client(getUri(server.info));
await client.connect({ auth: 'somestring' });
const { payload, statusCode } = await client.request('/');
expect(payload).to.equal('hello');
expect(statusCode).to.equal(200);
client.disconnect();
await server.stop();
});
What was the result you got?
Server crashed as headers cannot be assigned to string".
What result did you expect?
Validation of the auth object in some way.