diff options
Diffstat (limited to 'std/mime')
-rw-r--r-- | std/mime/multipart.ts | 16 | ||||
-rw-r--r-- | std/mime/multipart_test.ts | 34 |
2 files changed, 25 insertions, 25 deletions
diff --git a/std/mime/multipart.ts b/std/mime/multipart.ts index 0d60fd00b..6597a1bea 100644 --- a/std/mime/multipart.ts +++ b/std/mime/multipart.ts @@ -59,7 +59,7 @@ function randomBoundary(): string { export function matchAfterPrefix( buf: Uint8Array, prefix: Uint8Array, - eof: boolean + eof: boolean, ): -1 | 0 | 1 { if (buf.length === prefix.length) { return eof ? 1 : 0; @@ -98,7 +98,7 @@ export function scanUntilBoundary( dashBoundary: Uint8Array, newLineDashBoundary: Uint8Array, total: number, - eof: boolean + eof: boolean, ): number | null { if (total === 0) { // At beginning of body, allow dashBoundary. @@ -168,7 +168,7 @@ class PartReader implements Deno.Reader, Deno.Closer { this.mr.dashBoundary, this.mr.newLineDashBoundary, this.total, - eof + eof, ); if (this.n === 0) { // Force buffered I/O to read more into buffer. @@ -417,7 +417,7 @@ export class MultipartReader { function multipatFormData( fileMap: Map<string, FormFile | FormFile[]>, - valueMap: Map<string, string> + valueMap: Map<string, string>, ): MultipartFormData { function file(key: string): FormFile | FormFile[] | undefined { return fileMap.get(key); @@ -468,7 +468,7 @@ class PartWriter implements Deno.Writer { private writer: Deno.Writer, readonly boundary: string, public headers: Headers, - isFirstBoundary: boolean + isFirstBoundary: boolean, ) { let buf = ""; if (isFirstBoundary) { @@ -549,7 +549,7 @@ export class MultipartWriter { this.writer, this.boundary, headers, - !this.lastPart + !this.lastPart, ); this.lastPart = part; return part; @@ -559,7 +559,7 @@ export class MultipartWriter { const h = new Headers(); h.set( "Content-Disposition", - `form-data; name="${field}"; filename="${filename}"` + `form-data; name="${field}"; filename="${filename}"`, ); h.set("Content-Type", "application/octet-stream"); return this.createPart(h); @@ -580,7 +580,7 @@ export class MultipartWriter { async writeFile( field: string, filename: string, - file: Deno.Reader + file: Deno.Reader, ): Promise<void> { const f = await this.createFormFile(field, filename); await Deno.copy(file, f); diff --git a/std/mime/multipart_test.ts b/std/mime/multipart_test.ts index c0282ee3b..d2cfb2ee5 100644 --- a/std/mime/multipart_test.ts +++ b/std/mime/multipart_test.ts @@ -28,7 +28,7 @@ Deno.test("multipartScanUntilBoundary1", function (): void { dashBoundary, nlDashBoundary, 0, - true + true, ); assertEquals(n, null); }); @@ -40,7 +40,7 @@ Deno.test("multipartScanUntilBoundary2", function (): void { dashBoundary, nlDashBoundary, 0, - true + true, ); assertEquals(n, 3); }); @@ -52,7 +52,7 @@ Deno.test("multipartScanUntilBoundary3", function (): void { dashBoundary, nlDashBoundary, 0, - false + false, ); assertEquals(n, data.length); }); @@ -64,7 +64,7 @@ Deno.test("multipartScanUntilBoundary4", function (): void { dashBoundary, nlDashBoundary, 0, - false + false, ); assertEquals(n, 3); }); @@ -105,27 +105,27 @@ Deno.test("multipartMultipartWriter2", function (): void { assertThrows( (): MultipartWriter => new MultipartWriter(w, ""), Error, - "invalid boundary length" + "invalid boundary length", ); assertThrows( (): MultipartWriter => new MultipartWriter( w, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + - "aaaaaaaa" + "aaaaaaaa", ), Error, - "invalid boundary length" + "invalid boundary length", ); assertThrows( (): MultipartWriter => new MultipartWriter(w, "aaa aaa"), Error, - "invalid boundary character" + "invalid boundary character", ); assertThrows( (): MultipartWriter => new MultipartWriter(w, "boundary¥¥"), Error, - "invalid boundary character" + "invalid boundary character", ); }); @@ -139,7 +139,7 @@ Deno.test("multipartMultipartWriter3", async function (): Promise<void> { await mw.close(); }, Error, - "closed" + "closed", ); await assertThrowsAsync( async (): Promise<void> => { @@ -147,28 +147,28 @@ Deno.test("multipartMultipartWriter3", async function (): Promise<void> { await mw.writeFile("bar", "file", null as any); }, Error, - "closed" + "closed", ); await assertThrowsAsync( async (): Promise<void> => { await mw.writeField("bar", "bar"); }, Error, - "closed" + "closed", ); assertThrows( (): void => { mw.createFormField("bar"); }, Error, - "closed" + "closed", ); assertThrows( (): void => { mw.createFormFile("bar", "file"); }, Error, - "closed" + "closed", ); }); @@ -178,7 +178,7 @@ Deno.test({ const o = await Deno.open(path.resolve("./mime/testdata/sample.txt")); const mr = new MultipartReader( o, - "--------------------------434049563556637648550474" + "--------------------------434049563556637648550474", ); const form = await mr.readForm(); assertEquals(form.value("foo"), "foo"); @@ -250,7 +250,7 @@ Deno.test({ const o = await Deno.open(path.resolve("./mime/testdata/sample.txt")); const mr = new MultipartReader( o, - "--------------------------434049563556637648550474" + "--------------------------434049563556637648550474", ); const form = await mr.readForm(20); let file = form.file("file"); @@ -277,7 +277,7 @@ Deno.test({ const o = await Deno.open(path.resolve("./mime/testdata/sample.txt")); const mr = new MultipartReader( o, - "--------------------------434049563556637648550474" + "--------------------------434049563556637648550474", ); const form = await mr.readForm(); const map = new Map(form.entries()); |