From 775bd85848332a9b934247282dd885b6c8c42f54 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Fri, 25 Jan 2019 11:29:00 +0900 Subject: [PATCH 1/7] [bump] Start 0.8.4-SNAPSHOT --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74551d6f6c..c249dd91d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "piping-server", - "version": "0.8.3", + "version": "0.8.4-SNAPSHOT", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 04408ee5f1..4f7f022394 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "piping-server", - "version": "0.8.3", + "version": "0.8.4-SNAPSHOT", "description": "HTTP Piping Data Transfer Server", "bin": { "piping-server": "dist/src/index.js" From 428edebb5b24707249f625542428085d3a774140 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 27 Jan 2019 20:53:25 +0900 Subject: [PATCH 2/7] [test] Add a test of multipart --- test/piping.test.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/piping.test.ts b/test/piping.test.ts index 9f9ca16a87..da7f2575c0 100644 --- a/test/piping.test.ts +++ b/test/piping.test.ts @@ -675,4 +675,28 @@ describe("piping.Server", () => { }); }); + context("By multipart/data-form", () => { + it("should allow sender to send data via multipart", async () => { + const formData = { + "dummy form name": { + value: "this is a content", + options: { + contentType: "text/plain" + } + } + }; + + // Send data + request.post({url: `${pipingUrl}/mydataid`, formData: formData}); + + await sleep(10); + + const getPromise1 = thenRequest("GET", `${pipingUrl}/mydataid`); + + const getData1 = await getPromise1; + assert.equal(getData1.statusCode, 200); + assert.equal(getData1.getBody("UTF-8"), "this is a content"); + assert.equal(getData1.headers["content-type"], "text/plain"); + }); + }); }); From b55baf87d4f192faea276244a96bea278bec4d51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Sun, 27 Jan 2019 20:12:26 +0000 Subject: [PATCH 3/7] Bump ts-node from 8.0.1 to 8.0.2 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.0.1 to 8.0.2. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v8.0.1...v8.0.2) Signed-off-by: dependabot[bot] --- package-lock.json | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c249dd91d3..e96f47bafa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1929,17 +1929,24 @@ "dev": true }, "ts-node": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.0.1.tgz", - "integrity": "sha512-zER3Js6Iotp31ghen6nKjgX75UOipwTWX9T5fAVmHaaYAizWhOes4uAsLmDC8H51UG5tHL8gNjoa/wLFjo7wtA==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.0.2.tgz", + "integrity": "sha512-MosTrinKmaAcWgO8tqMjMJB22h+sp3Rd1i4fdoWY4mhBDekOwIAKI/bzmRi7IcbCmjquccYg2gcF6NBkLgr0Tw==", "dev": true, "requires": { "arg": "^4.1.0", - "arrify": "^1.0.0", "diff": "^3.1.0", "make-error": "^1.1.1", "source-map-support": "^0.5.6", - "yn": "^2.0.0" + "yn": "^3.0.0" + }, + "dependencies": { + "yn": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.0.0.tgz", + "integrity": "sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q==", + "dev": true + } } }, "tslib": { From 75839524f4526831798afb1dd45bafe02232531e Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Mon, 28 Jan 2019 13:03:02 +0900 Subject: [PATCH 4/7] [fix] Fix not to pass "undefined" if content-type in multipart is not present --- src/piping.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/piping.ts b/src/piping.ts index 3faa8d97a9..ebd7fd7c73 100644 --- a/src/piping.ts +++ b/src/piping.ts @@ -304,7 +304,10 @@ export class Server { part.byteCount === undefined ? {} : {"Content-Length": part.byteCount} ), - "Content-Type": part.headers["content-type"] + ...( + part.headers["content-type"] === undefined ? + {} : {"Content-Type": part.headers["content-type"]} + ) }; // Write headers to a receiver From 21b7ecd20213b8ef0ccb7db294deeb935137e5c5 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Mon, 28 Jan 2019 13:09:07 +0900 Subject: [PATCH 5/7] [test] Ensure to send data via multipart without multipart content-type --- test/piping.test.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/piping.test.ts b/test/piping.test.ts index da7f2575c0..a2a76ac467 100644 --- a/test/piping.test.ts +++ b/test/piping.test.ts @@ -676,7 +676,24 @@ describe("piping.Server", () => { }); context("By multipart/data-form", () => { - it("should allow sender to send data via multipart", async () => { + it("should allow sender to send data via multipart without multipart content-type", async () => { + const formData = { + "dummy form name": "this is a content" + }; + + // Send data + request.post({url: `${pipingUrl}/mydataid`, formData: formData}); + + await sleep(10); + + const getPromise1 = thenRequest("GET", `${pipingUrl}/mydataid`); + + const getData1 = await getPromise1; + assert.equal(getData1.statusCode, 200); + assert.equal(getData1.getBody("UTF-8"), "this is a content"); + }); + + it("should pass sender's Content-Type to receivers' one", async () => { const formData = { "dummy form name": { value: "this is a content", @@ -695,7 +712,6 @@ describe("piping.Server", () => { const getData1 = await getPromise1; assert.equal(getData1.statusCode, 200); - assert.equal(getData1.getBody("UTF-8"), "this is a content"); assert.equal(getData1.headers["content-type"], "text/plain"); }); }); From 76e5af6a19db45d378a6ae99c70a37acb1f63fbc Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Mon, 28 Jan 2019 13:20:58 +0900 Subject: [PATCH 6/7] [add] Add a text input to web client --- src/piping.ts | 54 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/src/piping.ts b/src/piping.ts index ebd7fd7c73..6703d03bda 100644 --- a/src/piping.ts +++ b/src/piping.ts @@ -92,8 +92,14 @@ const indexPage: string =

Piping

Streaming file sending/receiving
-

Step 1: Choose a file

-
+

Step 1: Choose a file or text

+ + : Text mode

+ + + +
+

Step 2: Write your secret path

(e.g. "abcd1234", "mysecret.png?n=3")

@@ -106,14 +112,46 @@ const indexPage: string = https://github.com/nwtgck/piping-server#readme
-`; + +`; /** * Generate help page From 92c90428c2daa22ff43cc13b8fc7a1ec52011bc0 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Mon, 28 Jan 2019 13:37:57 +0900 Subject: [PATCH 7/7] [bump/docs] Bump up version to 0.8.4 and Update CHANGELOG.md --- CHANGELOG.md | 9 ++++++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 116d427932..dd18a3ab48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [Unreleased] +## [0.8.4] - 2019-01-28 +### Fixed +* Fix not to pass "undefined" if content-type in multipart is not present +### Added +* Add a functionality of text input in web client + ## [0.8.3] - 2019-01-25 ### Added * Pass the sender's headers in multipart @@ -107,7 +113,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) * Docker automated build on Docker Hub * Support HTTPS -[Unreleased]: https://github.com/nwtgck/piping-server/compare/v0.8.3...HEAD +[Unreleased]: https://github.com/nwtgck/piping-server/compare/v0.8.4...HEAD +[0.8.4]: https://github.com/nwtgck/piping-seraver/compare/v0.8.3...v0.8.4 [0.8.3]: https://github.com/nwtgck/piping-seraver/compare/v0.8.2...v0.8.3 [0.8.2]: https://github.com/nwtgck/piping-seraver/compare/v0.8.1...v0.8.2 [0.8.1]: https://github.com/nwtgck/piping-seraver/compare/v0.8.0...v0.8.1 diff --git a/package-lock.json b/package-lock.json index e96f47bafa..8e86347471 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "piping-server", - "version": "0.8.4-SNAPSHOT", + "version": "0.8.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4f7f022394..271bab9e3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "piping-server", - "version": "0.8.4-SNAPSHOT", + "version": "0.8.4", "description": "HTTP Piping Data Transfer Server", "bin": { "piping-server": "dist/src/index.js"