Skip to content

Commit

Permalink
fix(nano-server): check method on getBody
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Dec 20, 2022
1 parent 753ef6e commit 9aa9857
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/nano-server/src/nano-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,11 @@ export class AlwatrConnection {
* ```
*/
async getBody(): Promise<string | null> {
// method must be POST or PUT or PATCH
if (!(this.method === 'POST' || this.method === 'PUT' || this.method === 'PATCH')) {
return null;
}

let body = '';

this.incomingMessage.on('data', (chunk: unknown) => {
Expand Down

0 comments on commit 9aa9857

Please sign in to comment.