Giter VIP home page Giter VIP logo

goalie's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goalie's Issues

npm test fails

Running npm test fails.

The full output of the run is at the bottom of this issue. It looks like all the tests are passing, but it says The following leaks were detected:BigUint64Array, BigInt64Array, BigInt, queueMicrotask

Poking around the issues in the lab repository, it seems that some of these stop being reported as leaks after upgrading lab, so fixing this might be as simple as upgrading to a newer version.

It looks like lab was deprecated, and if we upgrade to 18.1 or higher, we'll needto use @hapi/lab

Output:

$npm test

> @synapsestudios/[email protected] test /Users/adamgerbens/dev/goalie
> lab -vL -a code

smoke test
  ✔ 1) registers without errors (15 ms and 0 assertions)
(node:13840) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
Goalie
  ✔ 2) does nothing if api version is not supplied (17 ms and 2 assertions)
  ✔ 3) appends api version response header when api-version request header is not present (4 ms and 2 assertions)
  ✔ 4) appends api-version to error response (7 ms and 2 assertions)
  strict
    ✔ 5) appends api version response header when client and api versions match exactly (4 ms and 2 assertions)
    ✔ 6) responds with a 412 when the client and api versions do not match exactly (4 ms and 2 assertions)
  semver
    ✔ 7) returns 200 when apiVersion is v1.0.0 and request version is ^v1.0.0 (5 ms and 2 assertions)
    ✔ 8) returns 412 when apiVersion is v2.0.0 and request version is ^v1.0.0 (3 ms and 2 assertions)
    ✔ 9) returns 412 when apiVersion is v2.0.0 and request version is gobbledegook (2 ms and 2 assertions)
    ✔ 10) returns 200 when apiVersion is v2.0.0 and request version is ^v2.x (3 ms and 2 assertions)
  callback
    ✔ 11) calls the callback with request api-version and current api version (5 ms and 3 assertions)
    ✔ 12) appends api version response header when callback returns true (3 ms and 2 assertions)
    ✔ 13) responds with a 412 when the callback returns false (2 ms and 2 assertions)


13 tests complete
Test duration: 79 ms
Assertions count: 25 (verbosity: 1.92)
The following leaks were detected:BigUint64Array, BigInt64Array, BigInt, queueMicrotask
Linting results: No issues

npm ERR! Test failed.  See above for more details.

implement callback handling

in order to determine if the api-version in the request header should trigger a 412 call a callback and pass the request api-version and the current api version and allow the callback to resolve true or false. If false then return 412, if true allow the request to resolve normally.

Implement "strict" handling

if the api-version header in the client request header does not match the api version exactly return a 412

Set up linting

Using eslint and lab. Grab .eslintrc from one of our apis

implement semver handling

If the api-version value in the request header has a major version number that does not match the api's current major version number then respond with a 412

v2.0.0 : update to work with hapi 17

Update plugin handler to use the new async/await format
update tests to instantiate the hapi server the new way (update lab)
update docs if necessary

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.