-
Notifications
You must be signed in to change notification settings - Fork 0
Added ClearlyDefined as User-Agent in default header #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
970f2e9
to
62b0626
Compare
providers/fetch/mavenBasedFetch.js
Outdated
class MavenBasedFetch extends AbstractFetch { | ||
constructor(providerMap, options) { | ||
super(options) | ||
this._providerMap = { ...providerMap } | ||
this._handleRequestPromise = options.requestPromise || withDefaults(defaultHeaders) | ||
this._handleRequestPromise = options.requestPromise || callFetch | ||
this._handleRequestStream = options.requestStream || nodeRequest.defaults(defaultHeaders).get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be rewritten as
this._handleRequestStream = options.requestStream || nodeRequest.defaults({ headers: defaultHeaders }).get in order to maintain the previous arrangement. Please let me know if this sounds good to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Your way works! Another way can be
const { callFetch, defaultHeaders: headers } = require('../../lib/fetch')
...
const defaultHeaders = { headers }
Either one works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
condaFetch has the same header that can be refactored.
providers/fetch/mavenBasedFetch.js
Outdated
class MavenBasedFetch extends AbstractFetch { | ||
constructor(providerMap, options) { | ||
super(options) | ||
this._providerMap = { ...providerMap } | ||
this._handleRequestPromise = options.requestPromise || withDefaults(defaultHeaders) | ||
this._handleRequestPromise = options.requestPromise || callFetch | ||
this._handleRequestStream = options.requestStream || nodeRequest.defaults(defaultHeaders).get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Your way works! Another way can be
const { callFetch, defaultHeaders: headers } = require('../../lib/fetch')
...
const defaultHeaders = { headers }
Either one works.
@@ -61,10 +61,7 @@ class PackagistFetch extends AbstractFetch { | |||
if (!distUrl) return request.markSkip('Missing dist.url ') | |||
return new Promise((resolve, reject) => { | |||
const options = { | |||
url: distUrl, | |||
headers: { | |||
'User-Agent': 'clearlydefined.io crawler ([email protected])' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we have to use imported defaultHeaders
test/unit/lib/fetchTests.js
Outdated
}) | ||
|
||
it('checks if the default header user-agent is present in packagist components', async () => { | ||
const path = '/api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove test for packagist
64cf8bc
to
17a52ef
Compare
Merge branch 'master' into yk/add-default-headers-centrally
…' into yk/add-default-headers-centrally
…deploy update workflow to operations/v3.2.0 which adds latest tag for Docker Hub
No description provided.