Only using http in dev environments
This commit is contained in:
parent
41bfd1cd89
commit
e4630199a6
@ -1,5 +1,6 @@
|
||||
const got = require('got')
|
||||
const { Response } = require('./response.js')
|
||||
const fs = require('fs')
|
||||
|
||||
/**
|
||||
*
|
||||
@ -15,14 +16,19 @@ const { Response } = require('./response.js')
|
||||
|
||||
exports.Request = async function (method, domain, port, path, params, body=null) {
|
||||
try {
|
||||
// TODO: force https since actual servers do not response on port 80
|
||||
const url = `http://${domain}:${port}`
|
||||
let options = {
|
||||
let url = `https://${domain}:${port}${path}`
|
||||
const options = {
|
||||
method: method,
|
||||
searchParams: params,
|
||||
responseType: 'json',
|
||||
throwHttpErrors: false
|
||||
throwHttpErrors: false,
|
||||
}
|
||||
|
||||
// NOTE: only in dev environments do we use http
|
||||
if(process.env['DEV_ENV']) {
|
||||
url = `http://${domain}:${port}${path}`
|
||||
}
|
||||
|
||||
if(body) {
|
||||
options.body = body
|
||||
if(method == 'get') {
|
||||
|
Loading…
Reference in New Issue
Block a user