Skip to content

Commit

Permalink
test(hc-service-client): fix to new sign method
Browse files Browse the repository at this point in the history
  • Loading branch information
cctv1005s committed Sep 9, 2021
1 parent 6f530d3 commit 58000d7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: make install && npm run test
- run: make install && npm run cover
- run: make github_install && npm run test
- run: make github_install && npm run cover
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ test:
cover:
@npx nyc mocha $(TEST) -t 10000 --exit

github_install:
@npm install

install:
@npm install --registry=https://registry.npm.taobao.org

Expand Down
4 changes: 2 additions & 2 deletions lib/service_websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ module.exports = function (u, proxyHeaders) {
let customerQuery = qs.parse(url.parse(clientReq.url).query);
options.path = utils.mergeQuery(proxyUrl, defaultQuery, customerQuery);

const signHeader = systemSign({
const sign = systemSign({
accessKeyId: u.accessKeyId,
accessKeySecret: u.accessKeySecret,
path: options.path,
date: date,
log: u.log
});

Object.assign(options.headers, signHeader);
Object.assign(options.headers, sign.end(date));

const proxyReq = http.request(options);
proxyReq.on('error', (err) => {
Expand Down
1 change: 0 additions & 1 deletion test/server/http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ exports.start = function startServer(callback) {
const key = req.headers['sec-websocket-key'];

if(req.url.startsWith('/service-ws')) {
console.log(req.headers);
if(!req.headers.signature) {
return socket.write('HTTP/1.1 404');
}
Expand Down

0 comments on commit 58000d7

Please sign in to comment.