refactor: add check for request variables for env inspector
This commit is contained in:
@@ -18,6 +18,7 @@ import { invokeAction } from "~/helpers/actions"
|
|||||||
import { computed } from "vue"
|
import { computed } from "vue"
|
||||||
import { useStreamStatic } from "~/composables/stream"
|
import { useStreamStatic } from "~/composables/stream"
|
||||||
import { SecretEnvironmentService } from "~/services/secret-environment.service"
|
import { SecretEnvironmentService } from "~/services/secret-environment.service"
|
||||||
|
import { RESTTabService } from "~/services/tab/rest"
|
||||||
|
|
||||||
const HOPP_ENVIRONMENT_REGEX = /(<<[a-zA-Z0-9-_]+>>)/g
|
const HOPP_ENVIRONMENT_REGEX = /(<<[a-zA-Z0-9-_]+>>)/g
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ export class EnvironmentInspectorService extends Service implements Inspector {
|
|||||||
|
|
||||||
private readonly inspection = this.bind(InspectionService)
|
private readonly inspection = this.bind(InspectionService)
|
||||||
private readonly secretEnvs = this.bind(SecretEnvironmentService)
|
private readonly secretEnvs = this.bind(SecretEnvironmentService)
|
||||||
|
private readonly restTabs = this.bind(RESTTabService)
|
||||||
|
|
||||||
private aggregateEnvsWithSecrets = useStreamStatic(
|
private aggregateEnvsWithSecrets = useStreamStatic(
|
||||||
aggregateEnvsWithSecrets$,
|
aggregateEnvsWithSecrets$,
|
||||||
@@ -68,7 +70,14 @@ export class EnvironmentInspectorService extends Service implements Inspector {
|
|||||||
) => {
|
) => {
|
||||||
const newErrors: InspectorResult[] = []
|
const newErrors: InspectorResult[] = []
|
||||||
|
|
||||||
const envKeys = this.aggregateEnvsWithSecrets.value.map((e) => e.key)
|
const currentTab = this.restTabs.currentActiveTab.value
|
||||||
|
|
||||||
|
const environmentVariables = [
|
||||||
|
...currentTab.document.request.requestVariables,
|
||||||
|
...this.aggregateEnvsWithSecrets.value,
|
||||||
|
]
|
||||||
|
|
||||||
|
const envKeys = environmentVariables.map((e) => e.key)
|
||||||
|
|
||||||
target.forEach((element, index) => {
|
target.forEach((element, index) => {
|
||||||
if (isENVInString(element)) {
|
if (isENVInString(element)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user