Nest: @Headers

Created on 19 Feb 2018  路  4Comments  路  Source: nestjs/nest

[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Espa帽ol

Al intentar obtener los haeders de una petici贸n desde el controlador, en la consola obtengo el siguiente error

Consola

(node:24154) UnhandledPromiseRejectionWarning: #<ConflictException>
(node:24154) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24154) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Controlador

@Get('verify')
async getUser(@Headers() header: any) {
    return await header;
}

Most helpful comment

@bytewareKill try this:

@Get('verify')
async getUser(@Headers() headers: any) {
    console.log(headers);
    return ['yo', 'spain', 'friend'];
}

All 4 comments

Not sure what's going on here馃槄

@bytewareKill try this:

@Get('verify')
async getUser(@Headers() headers: any) {
    console.log(headers);
    return ['yo', 'spain', 'friend'];
}

I don't understand as well. @bytewareKill, please, use stackoverflow instead 馃檪

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings