Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
[Chocolatey Nuget] Fix "not found" error for chocolatey badge (badges…
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj authored Apr 2, 2024
1 parent 584e9fb commit 10b2f88
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions services/nuget/nuget-v2-service-family.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Joi from 'joi'
import queryString from 'query-string'
import { nonNegativeInteger } from '../validators.js'
import {
BaseJsonService,
Expand Down Expand Up @@ -61,25 +62,26 @@ async function fetch(
{ odataFormat, baseUrl, packageName, includePrereleases = false },
) {
const url = `${baseUrl}/Packages()`
const searchParams = {
$filter: createFilter({ packageName, includePrereleases }),
}
const searchParams = queryString.stringify(
{
$filter: createFilter({ packageName, includePrereleases }),
},
{ encode: false },
)

let packageData
if (odataFormat === 'xml') {
const data = await serviceInstance._requestXml({
schema: xmlSchema,
url,
options: { searchParams },
url: `${url}?${searchParams}`,
})
packageData = odataToObject(data.feed.entry)
} else if (odataFormat === 'json') {
const data = await serviceInstance._requestJson({
schema: jsonSchema,
url,
url: `${url}?${searchParams}`,
options: {
headers: { Accept: 'application/atom+json,application/json' },
searchParams,
},
})
packageData = data.d.results[0]
Expand Down

0 comments on commit 10b2f88

Please sign in to comment.