* Revert "send custom user agent when using got (#6256)"
This reverts commit fd7eddc7bb.
* Revert "Migrate request to got (part 1 of many) (#6160)"
This reverts commit 2359eb278b.
* install got as a prod dependency, allow npm 7
* install new packages
* migrate request to got
* update dynamic json test
This is a behavioural difference between request and got
request will send the request, then we'll get a
`400 Bad Request` back and re-throw at as invalid
got will pick up that the URL is invalid and throw
`RequestError: URI malformed` before attempting to send it
which we'll re-throw as inaccessible
* fix OPM service
* fix wordpress querystring
Got doesn't natively support assmebling a querystring
from nested objects because it uses node's URLSearchParams
internally. Use qs and pass qs a string.
Wordpress is the only service that needs this,
so we could build the string manually in this case
if we don't want to take qs as a prod dependency.
It is mostly hard-coded values anyway.
* fix wercker
got overwrites any ?foo=bar in the URL string if
searchParams is also passed whereas request appends
see https://github.com/sindresorhus/got#url
* fix keybase
* add tests for got wrapper
* bootstrap global agent in server start
* [Bitbucket Server] Adding Auth Tokens and Resolving Pull Request api issue. Added the bitbucket_server_username & bitbucket_server_password variables to the /core/server/server.js file. Also changed the user variable in the /services/bitbucket/bitbucket/bitbucket-pull-request.service.js the api documentation (https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287391664) defines the parameter as requiring the project name that the repository is contained in not the user name.
* [Bitbucket Server] Adding Auth Tokens and Resolving Pull Request api issue. Added the bitbucket_server_username & bitbucket_server_password variables to the /core/server/server.js file. Also changed the user variable in the /services/bitbucket/bitbucket/bitbucket-pull-request.service.js the api documentation (https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287391664) defines the parameter as requiring the project name that the repository is contained in not the user name.
* Update bitbucket-pull-request.service.js
Updating the label as Bitbucket and Bitbucket Server have different parameters in the Api call. Changing to compound name per @calebcartwright recomendation.
* Update server.js
Removing code that was refactored and caught in my Pull Request
* Reversing commit back on bitbucket-pull-request.service.js to its previous state.
Co-authored-by: danielle <185722+danielle@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* improve debug output for API calls with query strings
* update test
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Shields has long had an in-memory cache with some complex logic for determining when the cached values are used and when they are flushed. At the time this was implemented, squeezing cache performance was helpful since there was no downstream cache. For years now we've used Cloudflare as a CDN, so trying to cache onboard is less useful than before. Furthermore, since the cache is very small and only used in fairly restrictive ways, it probably has very little impact on performance.
* Test server running with metrics enabled
* Verify custom metric was send
* Extra code removed
* Tests moved to core/server/server.spec.js
* tickAsync value based on push interval
* Trigger Build
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
There is an internal `makeBadge()` function which is called from a few places in the server and from the public `makeBadge()` function which is a light wrapper. (Eventually we want to dogfood the public API: that's the work of #4950, and this helps with it by aligning the interfaces.)
Related to that is #3370, which is about aligning the `serviceData` schema (i.e. the result of `handle()`) with the public `makeBadge()` function.
A legacy quirk of the _private_ `makeBadge()` function is accepting a `text: ['label', 'message']` array instead of separate `{ label, message }` props like the rest of the codebase. `coalesceBadge()` has to translate from `{ label, message }` to `text: ['label', message']`. This removes that bit of indirection.
It also rewrites most of the tests of `coalesceBadge()` to use `.includes()`, providing IMO a slight improvement in readability.
This is the code part of #3027, following [this article](https://www.viget.com/articles/heroku-cloudflare-the-right-way/) and using [this middleware](https://github.com/clive-io/cloudflare-middleware).
I pulled in the `addHandlerAtIndex()` function @chris48s wrote for #5574.
The middleware isn't perfect for scoutcamp, since it relies on `req.ip` which is something set by Express. However, the other solutions I found were either explicitly deprecated ([cloudflare-ip](https://www.npmjs.com/package/cloudflare-ip)) or relied on dynamically fetching the list of Cloudflare hosts ([cloudflare-ips](https://www.npmjs.com/package/cloudflare-ips)), which seems unnecessary as this list has not changed in several years.
I've left this off to start, so we can test it in production using an env var before we make it the production default.
* added badge for total stars of an user / org
* Added a transformJson method in graphql-base to handle partial data
Co-authored-by: Pratapi Hemant Patel <pratpatel@expedia.com>
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Since we've upgraded production to Node 12 (#5436) we can finally adopt static fields!
This starts the process by updating core and one of the service families.
* Migrate [Discord] implementation to use bot token
* Rework authorization field creation
* Revert "Rework authorization field creation"
This reverts commit caf65bde5d.
* Add LGTM exclusion for hardcoded credentials
For some reason the `--delay` version is not working in Mocha 7. I'm not sure why that is. Although, invoking Mocha the normal synchronous way seems to be working fine, so maybe `--delay` just isn't necessary anymore for what we're doing in Shields.
I don't see anything in the changelog about this 🤷♂️Closes#4842