* feat: pass matching mime type to xmldom
If the `Content-Type` header contains one of the mime types supported by `DOMParser`, the first matching mime type will be used instead of `text/xml`.
The default is still `text/xml` for cases when the header is not present or none of the mime types from the list are present.
* factor out and add tests
---------
Co-authored-by: chris48s <git@chris-shaw.dev>
* log to sentry if upstream service responds with 429
* allow services to decide which error(s) to log, default to 429
* don't log 429s from endpoint or dynamic badges
* supress 429s from uptime robot badges
* supress 429s from weblate if not calling default server
* cache opencollective badges for longer
* cache discord badges for longer
* cache github workflow badges for longer
* add helper functions for generating Open API path/query params with defaults
* tweak Open API schema
- make description optional
- allow null example + allowEmptyValue (for boolean query params)
* convert examples --> openApi in amo
* convert examples --> openApi in ansible
* convert examples --> openApi in appveyor build/job
* add re-usable Open API query param for test-results badges
we can use these for all the 'test results' badges
* convert examples --> openApi in appveyor tests
* DRY up existing dynamic/endpoint param definitions
* DRY up queryParam
* allow enum param in serviceDefinition schema
* improve misleading param name
* check route and openApi are consistent on service load
* fix mistake in ansible role route
* documentation --> description
* add pathParams and queryParams helpers +docstrings
* give everything a search-friendly summary, check for duplicate summary
* prettier fixup
* allow serviceData to override cacheSeconds with a longer value
* prevent [endpoint] json cacheSeconds property exceeding service default
* allow ShieldsRuntimeError to specify a cacheSeconds property
By default error responses use the cacheLength of
the service class throwing the error.
This allows error to tell the handling layer the maxAge
that should be set on the error badge response.
* add customExceptions param
This
1. allows us to specify custom properties to pass to the exception
constructor if we throw any of the standard got errors
e.g: `ETIMEDOUT`, `ECONNRESET`, etc
2. uses a custom `cacheSeconds` property (if set on the exception)
to set the response maxAge
* customExceptions --> systemErrors
* errorMessages --> httpErrors
* WIP export OpenAPI definitions from service examples
* allow services to optionally define an OpenApi Paths Object instead of examples
* make use of param descriptions and required query params
* convert other 'core' services to declare openApi..
..instead of examples
* tweak descriptions for standard query params
* move stuff around, add a high-level integration test for category2openapi
* update simple-icons text refs #9054
* remove legacy param names
* Response size metric for all services
* Unused code removed
* Test for service response size metric
* All buckes of the service_response_bytes in a comment
* Register parameter in PrometheusMetrics is optional
* service response size metric enabled for dynamic badges
* Better test name
* JSDoc removed
* One import from one file
* Gather metrics in the background
* Revert saving response time metrics in the background
* Support XPath query with type convertion
* Support XPath query with node function
* Parametrized tests for transform function
* Handle unusual values returned by 'select'
This is a mid-sized PR that adds query param validation to BaseService and updates most of the services which use query param validation to use it. There are a couple minor tweaks I made along the way.
Fix#2676
Continue to implement #2698:
- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.