Skip to content

Commit

Permalink
migrate [MozillaObservatory] to /scan endpoint (#10491)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Sep 7, 2024
1 parent ffd0903 commit b0d9cb0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions services/mozilla-observatory/mozilla-observatory.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import Joi from 'joi'
import { BaseJsonService, pathParam } from '../index.js'

const schema = Joi.object({
scan: Joi.object({
grade: Joi.string()
.regex(/^[ABCDEF][+-]?$/)
.required(),
score: Joi.number().integer().min(0).max(200).required(),
}).required(),
grade: Joi.string()
.regex(/^[ABCDEF][+-]?$/)
.required(),
score: Joi.number().integer().min(0).max(200).required(),
}).required()

const description = `
Expand Down Expand Up @@ -69,15 +67,16 @@ export default class MozillaObservatory extends BaseJsonService {
async fetch({ host }) {
return this._requestJson({
schema,
url: 'https://observatory-api.mdn.mozilla.net/api/v2/analyze',
url: 'https://observatory-api.mdn.mozilla.net/api/v2/scan',
options: {
method: 'POST',
searchParams: { host },
},
})
}

async handle({ format, host }) {
const { scan } = await this.fetch({ host })
const scan = await this.fetch({ host })
return this.constructor.render({
format,
grade: scan.grade,
Expand Down

0 comments on commit b0d9cb0

Please sign in to comment.