Skip to content

Commit

Permalink
bearer token on request
Browse files Browse the repository at this point in the history
  • Loading branch information
kalesh13 committed Feb 28, 2022
1 parent b46565d commit d2b5629
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,17 @@ export class Request extends IncomingMessage implements IRequest {
return this._headers;
}

/**
* Returns the bearer token from the request
*
* @returns
*/
public bearerToken(): string {
const header = this.reqHeaders().get('Authorization', '');

return Str.trimStart(header, 'Bearer ');
}

/**
* Returns true if the request method is one of HEAD, GET
* and OPTIONS.
Expand Down

0 comments on commit d2b5629

Please sign in to comment.