mozilla-services / ip-reputation-js-client

A node JS client to the iprepd IP reputation service
Mozilla Public License 2.0
5 stars 8 forks source link

Remove use of legacy endpoints #40

Closed ajvb closed 4 years ago

ajvb commented 4 years ago

Removes the use of legacy iprepd endpoints and makes use of the new typed endpoints. This PR maintains the current API and extends it with new '<_>Typed' functions.

Fixes #39


@g-k There is one part I am still unsure of how to deal with, and that is the change from the response body for "get reputation" calls using ip as a key to now using object. The compat code in iprepd for this is here: https://github.com/mozilla-services/iprepd/blob/cd62a1f65e61ff91480ee07a0fa56232e2b471f8/score.go#L162-L172

Is there someway for me to include a compat layer in the returned Promise from getTyped()? How do I do something like that with Promises?

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 138


Totals Coverage Status
Change from base Build 130: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls
ajvb commented 4 years ago

I was wondering too if it's be worth adding some test cases specifically around what FxA currently expects as a result from the compatibility methods, to make sure that is accurate.

@ameihm0912 So from looking at FxA's code, they return response.body.reputation from the get() call (https://github.com/mozilla/fxa/blob/master/packages/fxa-customs-server/lib/reputationService.js#L56) and check the status code and timing phases of the request (added by the http request lib used in this package). We have tests that test for the reputation value, timing phases, and tons that check the status code using the compat get() and sendViolation() methods, so I think we currently do have tests that cover all of what FxA expects.