Skip to content

Commit

Permalink
fix(use): Set request readable encoding to utf-8
Browse files Browse the repository at this point in the history
Closes #118
  • Loading branch information
enisdenjo committed Apr 10, 2024
1 parent 94100d6 commit 50d3bcd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/use/express.ts
Expand Up @@ -132,6 +132,7 @@ function toRequest(
}
return new Promise<string>((resolve) => {
let body = '';
req.setEncoding('utf-8');
req.on('data', (chunk) => (body += chunk));
req.on('end', () => resolve(body));
});
Expand Down
1 change: 1 addition & 0 deletions src/use/http.ts
Expand Up @@ -142,6 +142,7 @@ function toRequest(
body: () =>
new Promise<string>((resolve) => {
let body = '';
req.setEncoding('utf-8');
req.on('data', (chunk) => (body += chunk));
req.on('end', () => resolve(body));
}),
Expand Down
1 change: 1 addition & 0 deletions src/use/http2.ts
Expand Up @@ -176,6 +176,7 @@ function toRequest(
body: () =>
new Promise<string>((resolve) => {
let body = '';
req.setEncoding('utf-8');
req.on('data', (chunk) => (body += chunk));
req.on('end', () => resolve(body));
}),
Expand Down
1 change: 1 addition & 0 deletions src/use/koa.ts
Expand Up @@ -126,6 +126,7 @@ export function createHandler<Context extends OperationContext = undefined>(
}
return new Promise<string>((resolve) => {
let body = '';
ctx.req.setEncoding('utf-8');
ctx.req.on('data', (chunk) => (body += chunk));
ctx.req.on('end', () => resolve(body));
});
Expand Down

0 comments on commit 50d3bcd

Please sign in to comment.