Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
e-moran committed Aug 19, 2024
1 parent ddbbd0b commit fb07e77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions body/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export function getBodySync(
callback: StreamReadCallback,
) {
const decoder = new TextDecoder(opts.encoding);
var buffer = "";
var complete = false;
var sync = true;
let buffer = "";
let complete = false;
let sync = true;

if (typeof stream.readable !== "undefined" && !stream.readable) {
done(new Error("stream is not readable"));
}

var received = 0;
let received = 0;

const limit = opts.limit || 0;
const length = opts.expectedLength || null;
Expand Down
18 changes: 9 additions & 9 deletions body/test/body.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AddressInfo } from "net";

describe("reads the body from the readable stream", () => {
test("should read normal body streams", (done) => {
var server = http.createServer((req, res) => {
const server = http.createServer((req, res) => {
getBodySync(
req,
{ encoding: "utf-8", limit: 1024 },
Expand All @@ -27,8 +27,8 @@ describe("reads the body from the readable stream", () => {
});

server.listen(function onListen() {
var addr = server.address() as AddressInfo;
var client = http.request({ method: "POST", port: addr.port });
const addr = server.address() as AddressInfo;
const client = http.request({ method: "POST", port: addr.port });

client.end("hello, world!");

Expand All @@ -48,7 +48,7 @@ describe("reads the body from the readable stream", () => {
});

test("should error if the body exceeds the length limit", (done) => {
var server = http.createServer((req, res) => {
const server = http.createServer((req, res) => {
getBodySync(
req,
{ encoding: "utf-8", limit: 4 },
Expand All @@ -68,8 +68,8 @@ describe("reads the body from the readable stream", () => {
});

server.listen(function onListen() {
var addr = server.address() as AddressInfo;
var client = http.request({ method: "POST", port: addr.port });
const addr = server.address() as AddressInfo;
const client = http.request({ method: "POST", port: addr.port });

client.end("i am a string");

Expand All @@ -90,7 +90,7 @@ describe("reads the body from the readable stream", () => {
});

test("should error if it isnt the exact length specified", (done) => {
var server = http.createServer((req, res) => {
const server = http.createServer((req, res) => {
getBodySync(
req,
{ encoding: "utf-8", limit: 1024, expectedLength: 4 },
Expand All @@ -112,8 +112,8 @@ describe("reads the body from the readable stream", () => {
});

server.listen(function onListen() {
var addr = server.address() as AddressInfo;
var client = http.request({ method: "POST", port: addr.port });
const addr = server.address() as AddressInfo;
const client = http.request({ method: "POST", port: addr.port });

client.end("hello, world!");

Expand Down

0 comments on commit fb07e77

Please sign in to comment.