Re-apply 'Migrate request to got (part 1)' (#6755)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Joi from 'joi'
|
||||
import qs from 'qs'
|
||||
import { nonNegativeInteger } from '../validators.js'
|
||||
import { BaseJsonService, NotFound } from '../index.js'
|
||||
|
||||
@@ -49,29 +50,32 @@ export default class BaseWordpress extends BaseJsonService {
|
||||
} else if (extensionType === 'theme') {
|
||||
schemas = themeSchemas
|
||||
}
|
||||
|
||||
const queryString = qs.stringify(
|
||||
{
|
||||
action: `${extensionType}_information`,
|
||||
request: {
|
||||
slug,
|
||||
fields: {
|
||||
active_installs: 1,
|
||||
sections: 0,
|
||||
homepage: 0,
|
||||
tags: 0,
|
||||
screenshot_url: 0,
|
||||
downloaded: 1,
|
||||
last_updated: 1,
|
||||
requires_php: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
{ encode: false }
|
||||
)
|
||||
|
||||
const json = await this._requestJson({
|
||||
url,
|
||||
schema: schemas,
|
||||
options: {
|
||||
qs: {
|
||||
action: `${extensionType}_information`,
|
||||
request: {
|
||||
slug,
|
||||
fields: {
|
||||
active_installs: 1,
|
||||
sections: 0,
|
||||
homepage: 0,
|
||||
tags: 0,
|
||||
screenshot_url: 0,
|
||||
downloaded: 1,
|
||||
last_updated: 1,
|
||||
requires_php: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
qsStringifyOptions: {
|
||||
encode: false,
|
||||
},
|
||||
qs: queryString,
|
||||
},
|
||||
})
|
||||
if ('error' in json) {
|
||||
|
||||
Reference in New Issue
Block a user