Files
shields/services/maven-central/maven-central-base.js
Ambati Mohan Kumar e3808c1738 [Maven] Added badge for Maven-Cenral last-update (#10301) (#10585)
* Added badge for Maven-Cenral last update.

* Update services/maven-central/maven-central-last-update.service.js

Co-authored-by: chris48s <chris48s@users.noreply.github.com>

* updated according to the review comments.

---------

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2024-10-12 08:52:08 +00:00

14 lines
467 B
JavaScript

import { BaseXmlService } from '../index.js'
export default class MavenCentralBase extends BaseXmlService {
async fetch({ groupId, artifactId, schema }) {
const group = encodeURIComponent(groupId).replace(/\./g, '/')
const artifact = encodeURIComponent(artifactId)
return this._requestXml({
schema,
url: `https://repo1.maven.org/maven2/${group}/${artifact}/maven-metadata.xml`,
httpErrors: { 404: 'artifact not found' },
})
}
}