Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix(kernel): deterministic form data processing (#4945)
Shreyas9cc8b680779c
diff --git a/packages/hoppscotch-agent/src-tauri/Cargo.lock b/packages/hoppscotch-agent/src-tauri/Cargo.lockindex 452d2ba2f..6ba8ec074 100644--- a/packages/hoppscotch-agent/src-tauri/Cargo.lock+++ b/packages/hoppscotch-agent/src-tauri/Cargo.lock@@ -4098,7 +4098,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"[[package]]name = "relay"version = "0.1.1"-source = "git+https://github.com/CuriousCorrelation/relay.git#893cec31865dc396a3d351781ec39b7625f59862"+source = "git+https://github.com/CuriousCorrelation/relay.git#cac0d123d0f7ff6971edacf5809c120d5378c25e"dependencies = ["bytes","curl",@@ -4106,7 +4106,6 @@ dependencies = ["env_logger","http","http-serde",- "indexmap 2.8.0","infer 0.16.0","lazy_static","log",diff --git a/packages/hoppscotch-common/src/helpers/functional/preprocess.ts b/packages/hoppscotch-common/src/helpers/functional/process-request.tssimilarity index 90%rename from packages/hoppscotch-common/src/helpers/functional/preprocess.tsrename to packages/hoppscotch-common/src/helpers/functional/process-request.tsindex e70835a4d..ff2eac9e8 100644--- a/packages/hoppscotch-common/src/helpers/functional/preprocess.ts+++ b/packages/hoppscotch-common/src/helpers/functional/process-request.ts@@ -2,8 +2,11 @@ import { pipe } from "fp-ts/function"import * as O from "fp-ts/Option"import * as E from "fp-ts/Either"import * as R from "fp-ts/Record"+import { cloneDeep } from "lodash-es"import { useSetting } from "~/composables/settings"+import superjson from "superjson"+import type { RelayRequest } from "@hoppscotch/kernel"const isEncoded = (value: string): boolean =>@@ -67,3 +70,6 @@ export const preProcessRelayRequest = (req: RelayRequest): RelayRequest =>): req)++export const postProcessRelayRequest = (req: RelayRequest): RelayRequest =>+ pipe(cloneDeep(req), (req) => superjson.serialize(req).json)diff --git a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/index.ts b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/index.tsindex 9a377d425..4ac554d4f 100644--- a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/index.ts+++ b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/index.ts@@ -4,7 +4,10 @@ import { body, relayRequestToNativeAdapter } from "@hoppscotch/kernel"import * as E from "fp-ts/Either"import { pipe } from "fp-ts/function"import axios, { CancelTokenSource } from "axios"-import { preProcessRelayRequest } from "~/helpers/functional/preprocess"+import {+ postProcessRelayRequest,+ preProcessRelayRequest,+} from "~/helpers/functional/process-request"import {RelayRequest,RelayResponse,@@ -148,8 +151,13 @@ export class AgentKernelInterceptorService},}+ const nativeRequest = await relayRequestToNativeAdapter(+ effectiveRequestWithUserAgent+ )+ const postProcessedRequest = postProcessRelayRequest(nativeRequest)+const [nonceB16, encryptedReq] = await this.store.encryptRequest(- await relayRequestToNativeAdapter(effectiveRequestWithUserAgent),+ postProcessedRequest,reqID)diff --git a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/store.ts b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/store.tsindex b8ef0e8f1..d786d9ff3 100644--- a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/store.ts+++ b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/agent/store.ts@@ -2,7 +2,6 @@ import { Service } from "dioc"import { ref } from "vue"import * as E from "fp-ts/Either"import axios from "axios"-import superjson from "superjson"import { Store } from "~/kernel/store"import type { PluginRequest, PluginResponse } from "@hoppscotch/kernel"import { x25519 } from "@noble/curves/ed25519"@@ -275,9 +274,7 @@ export class KernelInterceptorAgentStore extends Service {request: PluginRequest,reqID: number): Promise<[string, ArrayBuffer]> {- // eslint-disable-next-line @typescript-eslint/no-unused-vars- const { json, meta: _ } = superjson.serialize({ ...request, id: reqID })- const reqJSON = JSON.stringify(json)+ const reqJSON = JSON.stringify({ ...request, id: reqID })const reqJSONBytes = new TextEncoder().encode(reqJSON)const nonce = window.crypto.getRandomValues(new Uint8Array(12))const nonceB16 = base16.encode(nonce).toLowerCase()diff --git a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/browser/index.ts b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/browser/index.tsindex 90d40af50..cdd81a9e6 100644--- a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/browser/index.ts+++ b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/browser/index.ts@@ -12,7 +12,7 @@ import type {} from "~/services/kernel-interceptor.service"import { getI18n } from "~/modules/i18n"-import { preProcessRelayRequest } from "~/helpers/functional/preprocess"+import { preProcessRelayRequest } from "~/helpers/functional/process-request"import InterceptorsErrorPlaceholder from "~/components/interceptors/ErrorPlaceholder.vue"diff --git a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/extension/index.ts b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/extension/index.tsindex 0c377203d..45a033701 100644--- a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/extension/index.ts+++ b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/extension/index.ts@@ -7,7 +7,7 @@ import SettingsExtensionSubtitle from "~/components/settings/ExtensionSubtitle.vimport * as E from "fp-ts/Either"import { getI18n } from "~/modules/i18n"import { until } from "@vueuse/core"-import { preProcessRelayRequest } from "~/helpers/functional/preprocess"+import { preProcessRelayRequest } from "~/helpers/functional/process-request"import { browserIsChrome, browserIsFirefox } from "~/helpers/utils/userAgent"import type {KernelInterceptor,diff --git a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/native/index.ts b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/native/index.tsindex f60977d1f..6b2ede161 100644--- a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/native/index.ts+++ b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/native/index.ts@@ -2,8 +2,16 @@ import { markRaw } from "vue"import * as E from "fp-ts/Either"import { pipe } from "fp-ts/function"import { getI18n } from "~/modules/i18n"-import { preProcessRelayRequest } from "~/helpers/functional/preprocess"-import type { RelayCapabilities, RelayRequest } from "@hoppscotch/kernel"+import {+ postProcessRelayRequest,+ preProcessRelayRequest,+} from "~/helpers/functional/process-request"+import {+ relayRequestToNativeAdapter,+ type RelayCapabilities,+ type RelayRequest,+ type RelayResponse,+} from "@hoppscotch/kernel"import { Relay } from "~/kernel/relay"import { Service } from "dioc"import type {@@ -70,124 +78,150 @@ export class NativeKernelInterceptorServicepublic execute(request: RelayRequest): ExecutionResult<KernelInterceptorError> {- const effectiveRequest = this.store.completeRequest(- preProcessRelayRequest(request)- )- const relevantCookies = this.cookieJar.getCookiesForURL(- new URL(effectiveRequest.url!)- )+ let relayExecution: { cancel: () => Promise<void> } | null = null- if (relevantCookies.length > 0) {- effectiveRequest.headers!["Cookie"] = relevantCookies- .map((cookie) => `${cookie.name!}=${cookie.value!}`)- .join(";")+ return {+ cancel: async () => {+ if (relayExecution) {+ await relayExecution.cancel()+ }+ },+ response: pipe(+ this.executeRequest(request, (execution) => {+ relayExecution = execution+ }),+ (promise) =>+ promise.then((either) =>+ pipe(+ either,+ E.mapLeft((error): KernelInterceptorError => {+ const humanMessage = {+ heading: (t: ReturnType<typeof getI18n>) => {+ switch (error.kind) {+ case "network":+ return t("error.network.heading")+ case "timeout":+ return t("error.timeout.heading")+ case "certificate":+ return t("error.certificate.heading")+ case "auth":+ return t("error.auth.heading")+ case "proxy":+ return t("error.proxy.heading")+ case "parse":+ return t("error.parse.heading")+ case "version":+ return t("error.version.heading")+ case "abort":+ return t("error.aborted.heading")+ default:+ return t("error.unknown.heading")+ }+ },+ description: (t: ReturnType<typeof getI18n>) => {+ switch (error.kind) {+ case "network":+ return t("error.network.description", {+ message: error.message,+ cause: error.cause ?? t("error.unknown.cause"),+ })+ case "timeout":+ return t("error.timeout.description", {+ message: error.message,+ phase: error.phase ?? t("error.unknown.phase"),+ })+ case "certificate":+ return t("error.certificate.description", {+ message: error.message,+ cause: error.cause ?? t("error.unknown.cause"),+ })+ case "auth":+ return t("error.auth.description", {+ message: error.message,+ cause: error.cause ?? t("error.unknown.cause"),+ })+ case "proxy":+ return t("error.proxy.description", {+ message: error.message,+ cause: error.cause ?? t("error.unknown.cause"),+ })+ case "parse":+ return t("error.parse.description", {+ message: error.message,+ cause: error.cause ?? t("error.unknown.cause"),+ })+ case "version":+ return t("error.version.description", {+ message: error.message,+ cause: error.cause ?? t("error.unknown.cause"),+ })+ case "abort":+ return t("error.aborted.description", {+ message: error.message,+ })+ default:+ return t("error.unknown.description")+ }+ },+ }+ return {+ humanMessage,+ error,+ component: InterceptorsErrorPlaceholder,+ }+ })+ )+ )+ ),}+ }- const existingUserAgentHeader = Object.keys(- effectiveRequest.headers || {}- ).find((header) => header.toLowerCase() === "user-agent")+ private async executeRequest(+ request: RelayRequest,+ setRelayExecution: (execution: { cancel: () => Promise<void> }) => void+ ): Promise<E.Either<any, RelayResponse>> {+ try {+ const effectiveRequest = this.store.completeRequest(+ preProcessRelayRequest(request)+ )- // A temporary workaround to add a User-Agent header to the request- // This will be removed once the kernel/relay is updated to add User-Agent header by default- const effectiveRequestWithUserAgent = {- ...effectiveRequest,- headers: {- ...effectiveRequest.headers,- "User-Agent": existingUserAgentHeader- ? effectiveRequest.headers[existingUserAgentHeader]- : "HoppscotchKernel/0.1.0",- },- }+ const relevantCookies = this.cookieJar.getCookiesForURL(+ new URL(effectiveRequest.url!)+ )- const relayExecution = Relay.execute(effectiveRequestWithUserAgent)+ if (relevantCookies.length > 0) {+ effectiveRequest.headers!["Cookie"] = relevantCookies+ .map((cookie) => `${cookie.name!}=${cookie.value!}`)+ .join(";")+ }- const response = pipe(relayExecution.response, (promise) =>- promise.then((either) =>- pipe(- either,- E.mapLeft((error): KernelInterceptorError => {- const humanMessage = {- heading: (t: ReturnType<typeof getI18n>) => {- switch (error.kind) {- case "network":- return t("error.network.heading")- case "timeout":- return t("error.timeout.heading")- case "certificate":- return t("error.certificate.heading")- case "auth":- return t("error.auth.heading")- case "proxy":- return t("error.proxy.heading")- case "parse":- return t("error.parse.heading")- case "version":- return t("error.version.heading")- case "abort":- return t("error.aborted.heading")- default:- return t("error.unknown.heading")- }- },- description: (t: ReturnType<typeof getI18n>) => {- switch (error.kind) {- case "network":- return t("error.network.description", {- message: error.message,- cause: error.cause ?? t("error.unknown.cause"),- })- case "timeout":- return t("error.timeout.description", {- message: error.message,- phase: error.phase ?? t("error.unknown.phase"),- })- case "certificate":- return t("error.certificate.description", {- message: error.message,- cause: error.cause ?? t("error.unknown.cause"),- })- case "auth":- return t("error.auth.description", {- message: error.message,- cause: error.cause ?? t("error.unknown.cause"),- })- case "proxy":- return t("error.proxy.description", {- message: error.message,- cause: error.cause ?? t("error.unknown.cause"),- })- case "parse":- return t("error.parse.description", {- message: error.message,- cause: error.cause ?? t("error.unknown.cause"),- })- case "version":- return t("error.version.description", {- message: error.message,- cause: error.cause ?? t("error.unknown.cause"),- })- case "abort":- return t("error.aborted.description", {- message: error.message,- })- default:- return t("error.unknown.description")- }- },- }- return {- humanMessage,- error,- component: InterceptorsErrorPlaceholder,- }- })- )+ const existingUserAgentHeader = Object.keys(+ effectiveRequest.headers || {}+ ).find((header) => header.toLowerCase() === "user-agent")++ // A temporary workaround to add a User-Agent header to the request+ // This will be removed once the kernel/relay is updated to add User-Agent header by default+ const effectiveRequestWithUserAgent = {+ ...effectiveRequest,+ headers: {+ ...effectiveRequest.headers,+ "User-Agent": existingUserAgentHeader+ ? effectiveRequest.headers[existingUserAgentHeader]+ : "HoppscotchKernel/0.1.0",+ },+ }++ const nativeRequest = await relayRequestToNativeAdapter(+ effectiveRequestWithUserAgent)- )+ const postProcessedRequest = postProcessRelayRequest(nativeRequest)+ const relayExecution = Relay.execute(postProcessedRequest)- return {- cancel: relayExecution.cancel,- response,+ setRelayExecution(relayExecution)++ return await relayExecution.response+ } catch (e) {+ return E.left(e)}}}diff --git a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/proxy/index.ts b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/proxy/index.tsindex 281bc5bac..62d1ac20a 100644--- a/packages/hoppscotch-common/src/platform/std/kernel-interceptors/proxy/index.ts+++ b/packages/hoppscotch-common/src/platform/std/kernel-interceptors/proxy/index.ts@@ -21,7 +21,7 @@ import { pipe } from "fp-ts/function"import { getI18n } from "~/modules/i18n"import { v4 } from "uuid"-import { preProcessRelayRequest } from "~/helpers/functional/preprocess"+import { preProcessRelayRequest } from "~/helpers/functional/process-request"import { parseBytesToJSON } from "~/helpers/functional/json"import { decodeB64StringToArrayBuffer } from "~/helpers/utils/b64"diff --git a/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.lock b/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.lockindex 8f71e6fd0..097c73442 100644--- a/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.lock+++ b/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.lock@@ -188,7 +188,7 @@ checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"dependencies = ["cfg-if","crossbeam-utils",- "hashbrown 0.14.5",+ "hashbrown","lock_api","once_cell","parking_lot_core",@@ -238,12 +238,6 @@ dependencies = ["log",]-[[package]]-name = "equivalent"-version = "1.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"-[[package]]name = "fnv"version = "1.0.7"@@ -298,12 +292,6 @@ version = "0.14.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"-[[package]]-name = "hashbrown"-version = "0.15.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"-[[package]]name = "heck"version = "0.5.0"@@ -476,17 +464,6 @@ dependencies = ["icu_properties",]-[[package]]-name = "indexmap"-version = "2.8.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058"-dependencies = [- "equivalent",- "hashbrown 0.15.2",- "serde",-]-[[package]]name = "infer"version = "0.16.0"@@ -753,7 +730,6 @@ dependencies = ["env_logger","http","http-serde",- "indexmap","infer","lazy_static","log",diff --git a/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.toml b/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.tomlindex fd09a4882..951398622 100644--- a/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.toml+++ b/packages/hoppscotch-desktop/plugin-workspace/relay/Cargo.toml@@ -30,4 +30,3 @@ strum = { version = "0.26.3", features = ["derive"] }bytes = { version = "1.9.0", features = ["serde"] }mime = "0.3.17"url = "2.5.4"-indexmap = { version = "2.8.0", features = ["serde"] }diff --git a/packages/hoppscotch-desktop/plugin-workspace/relay/src/content.rs b/packages/hoppscotch-desktop/plugin-workspace/relay/src/content.rsindex b42a7d6c1..1517bab41 100644--- a/packages/hoppscotch-desktop/plugin-workspace/relay/src/content.rs+++ b/packages/hoppscotch-desktop/plugin-workspace/relay/src/content.rs@@ -1,6 +1,5 @@use curl::easy::Easy;use http::HeaderName;-use indexmap::IndexMap;use std::{collections::HashMap, path::Path};use crate::{@@ -201,7 +200,7 @@ impl<'a> ContentHandler<'a> {fn set_form_content(&mut self,- content: &IndexMap<String, Vec<FormValue>>,+ content: &Vec<(String, Vec<FormValue>)>,media_type: &MediaType,) -> Result<()> {/* TODO: Look into reintroducing this when auth handling is done by kernel */@@ -277,7 +276,7 @@ impl<'a> ContentHandler<'a> {fn set_multipart_content(&mut self,- content: &IndexMap<String, Vec<FormValue>>,+ content: &Vec<(String, Vec<FormValue>)>,media_type: &MediaType,) -> Result<()> {self.set_form_content(content, media_type)diff --git a/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs b/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rsindex 68d180214..df415212a 100644--- a/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs+++ b/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs@@ -2,7 +2,6 @@ use std::collections::HashMap;use bytes::Bytes;use http::{Method, StatusCode, Version};-use indexmap::IndexMap;use serde::{Deserialize, Serialize};use strum::{Display, EnumString};use time::OffsetDateTime;@@ -59,7 +58,7 @@ pub enum FormValue {},}-pub type FormData = IndexMap<String, Vec<FormValue>>;+pub type FormData = Vec<(String, Vec<FormValue>)>;#[derive(Debug, Serialize, Deserialize, Clone)]#[serde(tag = "kind", rename_all = "camelCase")]diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lockindex 2c032c885..c5ab525ec 100644--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock@@ -2888,7 +2888,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"[[package]]name = "relay"version = "0.1.1"-source = "git+https://github.com/CuriousCorrelation/relay.git#893cec31865dc396a3d351781ec39b7625f59862"+source = "git+https://github.com/CuriousCorrelation/relay.git#cac0d123d0f7ff6971edacf5809c120d5378c25e"dependencies = ["bytes","curl",@@ -2896,7 +2896,6 @@ dependencies = ["env_logger","http","http-serde",- "indexmap 2.8.0","infer 0.16.0","lazy_static","log",diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.tsindex 1095f2c53..536ac1daa 100644--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts@@ -10,7 +10,7 @@ export type FormDataValue = {contentType: string;data: Uint8Array;};-export type FormData = Map<string, FormDataValue[]>;+export type FormData = [string, FormDataValue[]][];export declare enum MediaType {TEXT_PLAIN = "text/plain",TEXT_HTML = "text/html",diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts.map b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts.mapindex 701d27a88..18a5d7781 100644--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts.map+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/dist-js/index.d.ts.map@@ -1 +1 @@-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["guest-js/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GACd,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,OAAO,CAAA;AAEX,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAA;AAEvE,MAAM,MAAM,UAAU,GAChB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,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,EAAE,OAAO,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtC,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAA;AAExC,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAEtE;AAED,wBAAsB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D"}\ No newline at end of file+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["guest-js/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GACd,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,OAAO,CAAA;AAEX,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAA;AAEvE,MAAM,MAAM,UAAU,GAChB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GAC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IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtC,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAA;AAExC,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAEtE;AAED,wBAAsB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D"}\ No newline at end of filediff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/guest-js/index.ts b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/guest-js/index.tsindex 75641aa1c..cc86a69dc 100644--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/guest-js/index.ts+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/guest-js/index.ts@@ -82,7 +82,7 @@ export type FormDataValue =| { kind: "text"; value: string }| { kind: "file"; filename: string; contentType: string; data: Uint8Array }-export type FormData = Map<string, FormDataValue[]>+export type FormData = [string, FormDataValue[]][]export enum MediaType {TEXT_PLAIN = "text/plain",diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.lock b/packages/hoppscotch-desktop/src-tauri/Cargo.lockindex 028eda2ac..46d43638a 100644--- a/packages/hoppscotch-desktop/src-tauri/Cargo.lock+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.lock@@ -3956,7 +3956,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"[[package]]name = "relay"version = "0.1.1"-source = "git+https://github.com/CuriousCorrelation/relay.git#893cec31865dc396a3d351781ec39b7625f59862"+source = "git+https://github.com/CuriousCorrelation/relay.git#cac0d123d0f7ff6971edacf5809c120d5378c25e"dependencies = ["bytes","curl",@@ -3964,7 +3964,6 @@ dependencies = ["env_logger","http","http-serde",- "indexmap 2.8.0","infer","lazy_static","log",@@ -5082,7 +5081,7 @@ dependencies = [[[package]]name = "tauri-plugin-relay"version = "0.1.0"-source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay#fee58601fb4b0c129b5a9d87aaa0f9f87c26cd09"+source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay#68d6b2532c900b4be24a038c49eec4794e990a3d"dependencies = ["relay","serde",diff --git a/packages/hoppscotch-kernel/src/relay/v/1.ts b/packages/hoppscotch-kernel/src/relay/v/1.tsindex 1c63debe4..d6562c16b 100644--- a/packages/hoppscotch-kernel/src/relay/v/1.ts+++ b/packages/hoppscotch-kernel/src/relay/v/1.ts@@ -590,11 +590,26 @@ export const content = {})}-// Helper function to convert standard `FormData` to `Map<string, FormDataValue[]>`-// This is mainly a crossplatform thing, once there's an equivalent and easy to impl `FormData` type for Rust,-// we can consider removing this.-const makeFormDataSerializable = async (formData: FormData): Promise<Map<string, FormDataValue[]>> => {- const result = new Map<string, FormDataValue[]>()+/**+ * Helper function to convert standard `FormData` to array of arrays `[string, FormDataValue[]][]`+ *+ * This implementation uses a Map to maintain insertion order of form fields,+ * required for certain multipart/form-data requests where field order matters.+ *+ * JavaScript Maps maintain insertion order (ECMAScript 2015+) unlike plain objects+ * before ES2015 ("own properties") where property enumeration order was not guaranteed,+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#description+ * > Although the keys of an ordinary Object are ordered now,+ * > this was not always the case, and the order is complex.+ * > As a result, it's best not to rely on property order.+ *+ * This preserves the original field order as per RFC 7578 section 5.2.+ * See: https://datatracker.ietf.org/doc/html/rfc7578#section-5.2+ * > Form processors given forms with a well-defined ordering SHOULD send back results in order.+ */+const makeFormDataSerializable = async (formData: FormData): Promise<[string, FormDataValue[]][]> => {+ const m = new Map<string, FormDataValue[]>()+// @ts-expect-error: `formData.entries` does exist but isn't visible,// see `"lib": ["ESNext", "DOM"],` in `tsconfig.json`for (const [key, value] of formData.entries()) {@@ -607,20 +622,26 @@ const makeFormDataSerializable = async (formData: FormData): Promise<Map<string,data: new Uint8Array(buffer)}- const existingValues = result.get(key) || []- result.set(key, [...existingValues, fileEntry])+ if (m.has(key)) {+ m.get(key)!.push(fileEntry)+ } else {+ m.set(key, [fileEntry])+ }} else {const textEntry: FormDataValue = {kind: "text",value: value.toString()}- const existingValues = result.get(key) || []- result.set(key, [...existingValues, textEntry])+ if (m.has(key)) {+ m.get(key)!.push(textEntry)+ } else {+ m.set(key, [textEntry])+ }}}- return result+ return Array.from(m.entries())}// Helper function to adapt a relay request to work with the plugin@@ -630,22 +651,16 @@ export const relayRequestToNativeAdapter = async (request: RelayRequest): Promisif (adaptedRequest.content?.kind === "multipart" && adaptedRequest.content.content instanceof FormData) {const serializableFormData = await makeFormDataSerializable(adaptedRequest.content.content);- // Replace with the converted form data- // SAFETY: Type assertion is necessary here because the plugin system expects- // types similar to Map<string, FormDataValue[]> instead of FormData.- // Then convert the `Map` to simpler nested object structure for better compatibility- // `Maps` it seems like are serialized differently across platforms and serialization libraries,- // while objects tend to maintain more consistent behavior by the sheer ubiquity of it.- const convertedContent: Record<string, FormDataValue[]> = {};-- for (const [key, values] of serializableFormData.entries()) {- convertedContent[key] = Array.isArray(values) ? values : [values];- }-adaptedRequest.content = {...adaptedRequest.content,+ // Replace with the converted form data+ // SAFETY: Type assertion is necessary here because the plugin system expects+ // types similar to Map<string, FormDataValue[]> instead of FormData.+ // Then convert the `Map` to simpler nested `Array` of `Array` structure for better compatibility+ // `Maps` it seems like are serialized differently across platforms and serialization libraries,+ // while `Array` of `Array` tend to maintain more consistent behavior by the sheer ubiquity of it.// @ts-expect-error: This is intentional to work around SuperJSON serialization- content: convertedContent+ content: serializableFormData};}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 0a17a1a34..bfd0987ec 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1181,7 +1181,7 @@ importers:dependencies:'@hoppscotch/plugin-relay':specifier: github:CuriousCorrelation/tauri-plugin-relay- version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/fee58601fb4b0c129b5a9d87aaa0f9f87c26cd09'+ version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/68d6b2532c900b4be24a038c49eec4794e990a3d''@tauri-apps/api':specifier: 2.1.1version: 2.1.1@@ -1810,8 +1810,8 @@ packages:resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1c2e8b19db7f1b6af6d00abb907f15cdc2017298}version: 0.1.0- '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/fee58601fb4b0c129b5a9d87aaa0f9f87c26cd09':- resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/fee58601fb4b0c129b5a9d87aaa0f9f87c26cd09}+ '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/68d6b2532c900b4be24a038c49eec4794e990a3d':+ resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/68d6b2532c900b4be24a038c49eec4794e990a3d}version: 0.1.0'@alloc/[email protected]':@@ -13208,7 +13208,7 @@ snapshots:dependencies:'@tauri-apps/api': 2.1.1- '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/fee58601fb4b0c129b5a9d87aaa0f9f87c26cd09':+ '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/68d6b2532c900b4be24a038c49eec4794e990a3d':dependencies:'@tauri-apps/api': 2.1.1