From 14b6f581460d97df7691c86be5da3d450b441d22 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Sat, 2 May 2020 15:04:28 +0100 Subject: [PATCH 1/2] chore: demand up to date yargs --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca4405878..f0b2c83ca 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "webpack-bundle-analyzer": "^3.7.0", "webpack-cli": "^3.3.10", "webpack-merge": "^4.2.2", - "yargs": "^15.1.0", + "yargs": "^15.3.1", "yargs-parser": "^18.1.3" }, "devDependencies": { From 06a17b06809e580f2c8637bf6bf178e0e9925a69 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Sat, 2 May 2020 15:04:47 +0100 Subject: [PATCH 2/2] feat: add endpoint to echo server to echo request headers --- test/utils/echo-server.js | 6 ++++++ utils/echo-server.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/test/utils/echo-server.js b/test/utils/echo-server.js index 566c67027..44988d64c 100644 --- a/test/utils/echo-server.js +++ b/test/utils/echo-server.js @@ -58,4 +58,10 @@ describe('echo server spec', () => { const res = Buffer.from(await req.arrayBuffer()) expect(res).to.be.deep.eq(Buffer.from('hello world')) }) + + it('get with headers', async () => { + const req = await http.get('echo/headers', { base: url, headers: { foo: 'bar' } }) + const res = await req.json() + expect(res).to.deep.include({ foo: 'bar' }) + }) }) diff --git a/utils/echo-server.js b/utils/echo-server.js index 6f60c70a0..b8b1d1d4d 100644 --- a/utils/echo-server.js +++ b/utils/echo-server.js @@ -29,6 +29,9 @@ class EchoServer { .all('/echo/query', (req, res) => { send(res, 200, req.query) }) + .all('/echo/headers', (req, res) => { + send(res, 200, req.headers) + }) .all('/echo', (req, res) => { send(res, 200, req) })