Swap from request to got

This commit is contained in:
Michael Morrison 2020-07-04 23:28:03 -05:00
parent 67563c0f1e
commit 487b17dd73
9 changed files with 215 additions and 340 deletions

View file

@ -3,12 +3,12 @@ const Core = require('./core');
class AssettoCorsa extends Core {
async run(state) {
const serverInfo = await this.request({
json: true,
uri: `http://${this.options.address}:${this.options.port}/INFO`
url: `http://${this.options.address}:${this.options.port}/INFO`,
responseType: 'json'
});
const carInfo = await this.request({
json: true,
uri: `http://${this.options.address}:${this.options.port}/JSON|${parseInt(Math.random() * 999999999999999, 10)}`
url: `http://${this.options.address}:${this.options.port}/JSON|${parseInt(Math.random() * 999999999999999, 10)}`,
responseType: 'json'
});
if (!serverInfo || !carInfo || !carInfo.Cars) {