While working on some tests, I was having a tricky problem in a test suite. Eventually I tracked it down to an interaction between tests. I suspected the test library, but once I tried to make an isolated test case, I realized the test library was working fine. It turns out it was the server’s request cache. The fix is to clear the cache between tests.
Not needed for this PR, though I’m adding it to this branch because it conflicts with this change.
Running the server in process is necessary for the mock to work. This is an approach I’ve taken in the past. I experimented with this setup quite a bit when I was playing around with a test suite, and it seemed to work well enough. Setting `process.argv` is a admitedly a bit gross, though a cleaner approach would require more involved changes to `server.js`.
Given the chunks coming from imagemagick are getting stored memory and
then tucked into a cache, this function could as easily return a buffer
via callback. Streaming is just making it more complex. (And trickier to
test!)
The OpenAPI Specification (formerly known as the Swagger RESTful API
Documentation Specification) defines a format for describing RESTful
APIs. The Swagger project provides a set of tools for working with this
format, including a hosted validator which provides a validation badge
and JSON result.[1] This commit adds shields.io support for this badge.
The service currently only provides validation of files conforming to
version 2.0 of the OpenAPI Specification. This commit adds a path
component for specifying the version under the assumption that the
validator may support version 3.0 or later as they are released.
It accepts the URL to validate as two path components, a scheme followed
by the rest of the URL, to match the convention used for the JIRA host
and webpage online shields.
Changes in v2:
- Use bitbucket in try.html example for clarity.
- Change /v/ in URL to /valid/ to avoid conflict with v=version.
1. https://github.com/swagger-api/validator-badge
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
The following warning is emitted by Node.js:
> DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new
> Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or
> `Buffer.alloc()` instead.
This patch removes this warning.
Projects that have '0' technical debt would otherwise receive a
lightgrey badge instead of a brightgreen one.
Signed-off-by: Sebastian Hoß <mail@shoss.de>
- Use metric() for the displayed number
- Use encodeURI() for API parameters
- Explicitly use a condition expression instead of a number where a boolean is expected
Part of #790.
As raised by Adriaan (@agboom), the .github-user-tokens.json file was
incorrectly exposed, causing the risk of users' GitHub tokens to be used
by other entities for the purpose of increasing their rate limits by
pretending to be shields.io.
Mozilla's website uses that format.
Also, show star-rating as "4/5" instead of "4 stars" (which looks verbose, less
informative, and grammatically incorrect if there is a single star).