fix #2212: responseType:json for got 10.x calls
This commit is contained in:
Родитель
45484cd07c
Коммит
9586fc61cc
16
README.md
16
README.md
|
@ -138,6 +138,22 @@ To run tests with interactive `debugger` lines enabled:
|
|||
NODE_ENV=tests node inspect --harmony ./node_modules/.bin/jest tests/home.test.js
|
||||
```
|
||||
|
||||
### Test Firefox Integration
|
||||
|
||||
Firefox's internal about:protections page ("Protections Dashboard") fetches and
|
||||
displays breach stats for Firefox users who are signed into their FXA.
|
||||
|
||||
To test this part of Monitor:
|
||||
|
||||
1. [Set a Firefox profile to use the staging Firefox Accounts
|
||||
server.](https://mozilla.github.io/ecosystem-platform/docs/process/using-the-staging-environment#working-with-staging-firefox-accounts)
|
||||
2. In the same profile, go to about:config and replace [all
|
||||
`https://monitor.firefox.com`
|
||||
values](https://searchfox.org/mozilla-central/search?q=monitor.firefox.com&path=browser/app/profile/firefox.js) with `http://localhost:6060`
|
||||
3. Restart Firefox with that profile.
|
||||
4. Go to `about:protections`
|
||||
5. Everything should be using your localhost instance of Monitor.
|
||||
|
||||
### Lint
|
||||
|
||||
After installing the dependencies, you can lint the code by calling:
|
||||
|
|
|
@ -529,6 +529,13 @@ async function getPreferences(req, res) {
|
|||
}
|
||||
|
||||
|
||||
// This endpoint returns breach stats for Firefox clients to display
|
||||
// in about:protections
|
||||
//
|
||||
// Firefox sends a signed JWT in the Authorization header. We verify this JWT
|
||||
// with the FXA verification endpoint before we return breach stats.
|
||||
//
|
||||
// To test this endpoint, see the "Test Firefox Integration" section of the README.
|
||||
async function getBreachStats(req, res) {
|
||||
if (!req.token) {
|
||||
return res.status(401).json({
|
||||
|
|
|
@ -37,6 +37,7 @@ const FXA = {
|
|||
const tokenOptions = {
|
||||
method: "POST",
|
||||
json: tokenBody,
|
||||
responseType: "json",
|
||||
};
|
||||
|
||||
try {
|
||||
|
|
|
@ -31,6 +31,7 @@ const RemoteSettings = {
|
|||
username: FX_RS_WRITER_USER,
|
||||
password: FX_RS_WRITER_PASS,
|
||||
json: { data },
|
||||
responseType: "json",
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -39,6 +40,7 @@ const RemoteSettings = {
|
|||
username: FX_RS_WRITER_USER,
|
||||
password: FX_RS_WRITER_PASS,
|
||||
json: { data: {status: "to-review"} },
|
||||
responseType: "json",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче