From 713f4a79e978eb63c96b2539914d5d67de10724d Mon Sep 17 00:00:00 2001 From: Andreas Weber Date: Thu, 23 Mar 2023 21:40:25 +0100 Subject: [PATCH] docs: update changelog --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- src/test/scripts/javascript.spec.ts | 30 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/test/scripts/javascript.spec.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c7b561e..e1215926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 6.3.3 (2023-03-23) + +### Fixes + +- allow async/await syntax in code snippets (#398) +- unable to use variable as graphql input (#421) + ## 6.3.2 (2023-03-17) ### Fixes diff --git a/package-lock.json b/package-lock.json index 352b3f72..d8b21373 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "httpyac", - "version": "6.3.2", + "version": "6.3.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "httpyac", - "version": "6.3.2", + "version": "6.3.3", "license": "MIT", "dependencies": { "@cloudamqp/amqp-client": "^2.1.1", diff --git a/package.json b/package.json index b60adbb4..faaa3b66 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "MIT", "publisher": "AnWeber", "description": "HTTP/REST CLI Client for *.http files", - "version": "6.3.2", + "version": "6.3.3", "homepage": "https://github.com/AnWeber/httpyac", "repository": { "type": "git", diff --git a/src/test/scripts/javascript.spec.ts b/src/test/scripts/javascript.spec.ts new file mode 100644 index 00000000..7c3c8cb4 --- /dev/null +++ b/src/test/scripts/javascript.spec.ts @@ -0,0 +1,30 @@ +import { initFileProvider, sendHttp } from '../testUtils'; +import { getLocal } from 'mockttp'; + +describe('scripts.javascript', () => { + const localServer = getLocal(); + beforeEach(() => localServer.start()); + afterEach(() => localServer.stop()); + + it('basic auth', async () => { + initFileProvider(); + const mockedEndpoints = await localServer.forGet('/json').thenJson(200, { foo: 'bar', test: 1 }); + + await sendHttp(` + {{ + //pre request script + const crypto = require('crypto'); + const date = new Date(); + const signatureBase64 = crypto.createHmac('sha256', 'secret') + .update(\`\${request.method}\u2028\${request.url}\`).digest("base64"); + exports.authentcation = \`Basic \${signatureBase64}\`; + }} + GET http://localhost:${localServer.port}/json + authorization: {{authentcation}} + + `); + + const requests = await mockedEndpoints.getSeenRequests(); + expect(requests[0].headers.authorization).toBe('Basic H9PPJrcxbDVji+d8UTU7Yr5bYn+MEZwW3Y2NPmgQI0Q='); + }); +});