feat: move pre request script to new state system
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
getGlobalEnvironment,
|
||||
} from "~/newstore/environments"
|
||||
|
||||
export default function getEnvironmentVariablesFromScript(script: any) {
|
||||
export default function getEnvironmentVariablesFromScript(script: string) {
|
||||
const _variables: Record<string, string> = {}
|
||||
|
||||
const currentEnv = getCurrentEnvironment()
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface HoppRESTRequest {
|
||||
endpoint: string
|
||||
params: HoppRESTParam[]
|
||||
headers: HoppRESTHeader[]
|
||||
preRequestScript: string
|
||||
}
|
||||
|
||||
export function makeRESTRequest(
|
||||
@@ -54,12 +55,17 @@ export function translateToNewRequest(x: any): HoppRESTRequest {
|
||||
|
||||
const method = x.method
|
||||
|
||||
return {
|
||||
const preRequestScript = x.preRequestScript
|
||||
|
||||
const result: HoppRESTRequest = {
|
||||
endpoint,
|
||||
headers,
|
||||
params,
|
||||
method,
|
||||
preRequestScript,
|
||||
v: RESTReqSchemaVersion,
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user