fetch-github-app
Advanced tools
Comparing version 0.1.0 to 0.2.0
39
index.js
@@ -70,5 +70,17 @@ 'use strict'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
['appId', 'appPrivateKey', 'installationId', 'userAgent'].forEach(key => { | ||
assert.ok(config[key], `Missing configuration value for "${key}".`); | ||
}); | ||
assert(typeof config.appId === 'number', 'appId should be a number'); | ||
assert( | ||
/-----BEGIN RSA PRIVATE KEY-----[\s\S]+-----END RSA PRIVATE KEY-----/m.test( | ||
config.appPrivateKey | ||
), | ||
'appPrivateKey should be a valid RSA private key' | ||
); | ||
assert( | ||
typeof config.installationId === 'number', | ||
'installationId should be a number' | ||
); | ||
assert( | ||
typeof config.userAgent === 'string', | ||
'userAgent should be a string' | ||
); | ||
} | ||
@@ -80,14 +92,11 @@ | ||
getGithubApiUrl(path), | ||
Object.assign( | ||
{ | ||
headers: Object.assign( | ||
getApiRequestHeaders({ | ||
installationAccessToken, | ||
userAgent: config.userAgent, | ||
}), | ||
request.headers || {} | ||
), | ||
}, | ||
request | ||
) | ||
Object.assign({}, request, { | ||
headers: Object.assign( | ||
getApiRequestHeaders({ | ||
installationAccessToken, | ||
userAgent: config.userAgent, | ||
}), | ||
request.headers || {} | ||
), | ||
}) | ||
); | ||
@@ -94,0 +103,0 @@ |
@@ -11,3 +11,3 @@ { | ||
"devDependencies": { | ||
"dotenv": "^4.0.0", | ||
"envalid": "^3.1.1", | ||
"eslint": "^4.0.0", | ||
@@ -23,3 +23,5 @@ "eslint-config-prettier": "^2.1.1", | ||
}, | ||
"files": ["index.js"], | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
@@ -30,3 +32,3 @@ "node", | ||
"app", | ||
"api" | ||
"api" | ||
], | ||
@@ -47,3 +49,3 @@ "license": "MIT", | ||
}, | ||
"version": "0.1.0" | ||
"version": "0.2.0" | ||
} |
@@ -0,1 +1,4 @@ | ||
[![npm version](https://img.shields.io/npm/v/fetch-github-app.svg)](https://npmjs.org/package/fetch-github-app) | ||
[![build status](https://img.shields.io/circleci/project/github/activeviam/fetch-github-app.svg)](https://circleci.com/gh/activeviam/fetch-github-app) | ||
# Goal | ||
@@ -40,2 +43,1 @@ | ||
3. `npm test` | ||
Sorry, the diff of this file is not supported yet
7547
93
43