From 8597c04ff1329ec73409158755712e56ec3ef4bc Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 21 Jul 2021 23:56:39 -0400 Subject: [PATCH] feat: test script and pre-request script wiring --- components/http/Request.vue | 17 +--- components/http/Tests.vue | 4 +- helpers/RequestRunner.ts | 147 ++++++++++++++++++++++++++++++++ helpers/preRequest.ts | 2 +- helpers/types/HoppTestResult.ts | 14 +++ newstore/RESTSession.ts | 25 ++++++ 6 files changed, 193 insertions(+), 16 deletions(-) create mode 100644 helpers/RequestRunner.ts create mode 100644 helpers/types/HoppTestResult.ts diff --git a/components/http/Request.vue b/components/http/Request.vue index 418092ad8..33c2c473d 100644 --- a/components/http/Request.vue +++ b/components/http/Request.vue @@ -74,7 +74,7 @@ import { updateRESTResponse, - restRequest$, restEndpoint$, setRESTEndpoint, restMethod$, updateRESTMethod, } from "~/newstore/RESTSession" -import { createRESTNetworkRequestStream } from "~/helpers/network" -import { currentEnvironment$ } from "~/newstore/environments" -import { getEffectiveRESTRequestStream } from "~/helpers/utils/EffectiveURL" import { getPlatformSpecialKey } from "~/helpers/platformutils" +import { runRESTRequest$ } from "~/helpers/RequestRunner" export default { data() { @@ -220,7 +217,6 @@ export default { showCurlImportModal: false, showCodegenModal: false, navigatorShare: navigator.share, - effectiveStream$: null, loading: false, } }, @@ -228,10 +224,6 @@ export default { return { newMethod$: restMethod$, newEndpoint$: restEndpoint$, - effectiveStream$: getEffectiveRESTRequestStream( - restRequest$, - currentEnvironment$ - ), } }, watch: { @@ -247,10 +239,7 @@ export default { newSendRequest() { this.loading = true this.$subscribeTo( - createRESTNetworkRequestStream( - this.effectiveStream$, - currentEnvironment$ - ), + runRESTRequest$(), (responseState) => { console.log(responseState) updateRESTResponse(responseState) diff --git a/components/http/Tests.vue b/components/http/Tests.vue index 7493d3a13..9df9b5c2e 100644 --- a/components/http/Tests.vue +++ b/components/http/Tests.vue @@ -79,12 +79,14 @@