Skip to content

Commit

Permalink
fix(action): remove default api vesrion header
Browse files Browse the repository at this point in the history
  • Loading branch information
spirosikmd committed Jun 12, 2018
1 parent 1fafe92 commit da0f943
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
10 changes: 1 addition & 9 deletions lib/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ const request = require('./request');
const { sign } = require('./signing');
const ClientError = require('./error');

// This doesn't really make sense anymore as the version won't change (0.0.0-development)
// We should probably read the tags and use the latest one as version.
function getDefaultHeaders(version) {
return {
'x-ub-api-client': `Usabilla API Node Client/${version}`
};
}

function performRequest(requestOptions, accessKey, privateKey, options, items) {
const signature = sign(
accessKey,
Expand Down Expand Up @@ -67,7 +59,7 @@ function action(
iterator: apiOptions.iterator,
method: endpointOptions.method,
path: endpointOptions.path,
headers: getDefaultHeaders(process.env.VERSION)
headers: {}
};

return performRequest(requestOptions, accessKey, privateKey, options, []);
Expand Down
3 changes: 1 addition & 2 deletions test/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ describe('action', () => {
baseURL: 'https://localhost',
headers: {
Authorization:
'USBL1-HMAC-SHA256 Credential=access-key/20160101/usbl1_request, SignedHeaders=host;x-ub-api-client;x-usbl-date, Signature=7f71ccd5a740b72a229f8f6aee0b738b9b4f1e5106efe51da785fa3574116f9b',
'USBL1-HMAC-SHA256 Credential=access-key/20160101/usbl1_request, SignedHeaders=host;x-usbl-date, Signature=bdbf025412de09a0331ee3810533f7c69146413745da0412a8d2a71a7d2ba0ce',
host: 'data.usabilla.com',
'x-ub-api-client': 'Usabilla API Node Client/undefined',
'x-usbl-date': '20160101T000000Z'
},
method: 'get',
Expand Down
9 changes: 1 addition & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const path = require('path');
const webpack = require('webpack');
const packageJson = require('./package.json');

module.exports = {
entry: './lib/index.js',
Expand All @@ -20,10 +18,5 @@ module.exports = {
use: 'babel-loader'
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(packageJson.version)
})
]
}
};

0 comments on commit da0f943

Please sign in to comment.