Skip to content

Commit

Permalink
refactor: move user agent insertion into util/got
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jun 12, 2020
1 parent 1c92405 commit b62c3b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions lib/util/got/index.ts
@@ -1,7 +1,6 @@
import auth from './auth';
import cacheGet from './cache-get';
import hostRules from './host-rules';
import renovateAgent from './renovate-agent';
import { mergeInstances } from './util';

export * from './common';
Expand All @@ -12,6 +11,6 @@ export * from './common';
* - Cache all GET requests for the lifetime of the repo
*
*/
export const api = mergeInstances(cacheGet, renovateAgent, hostRules, auth);
export const api = mergeInstances(cacheGet, hostRules, auth);

export default api;
11 changes: 0 additions & 11 deletions lib/util/got/renovate-agent.ts

This file was deleted.

4 changes: 4 additions & 0 deletions lib/util/http/index.ts
Expand Up @@ -67,6 +67,10 @@ export class Http<GetOptions = HttpOptions, PostOptions = HttpPostOptions> {
},
],
};
combinedOptions.headers = combinedOptions.headers || {};
combinedOptions.headers['user-agent'] =
process.env.RENOVATE_USER_AGENT ||
'https://github.com/renovatebot/renovate';
const res = await got(resolvedUrl, combinedOptions);
return { body: res.body, headers: res.headers };
}
Expand Down

0 comments on commit b62c3b1

Please sign in to comment.