Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix(relay): expand MIME type support (#5306)

Shreyas137e95e873f8
diff --git a/packages/hoppscotch-agent/src-tauri/Cargo.lock b/packages/hoppscotch-agent/src-tauri/Cargo.lock
index 1e2d129e5..5837dcf4b 100644
--- a/packages/hoppscotch-agent/src-tauri/Cargo.lock
+++ b/packages/hoppscotch-agent/src-tauri/Cargo.lock
@@ -4110,7 +4110,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "relay"
version = "0.1.1"
-source = "git+https://github.com/CuriousCorrelation/relay.git#dfa662f2e8a2731cd21c59b2a10bfc6e2ef70ca3"
+source = "git+https://github.com/CuriousCorrelation/relay.git#10aca0e5d74515a6fed231ee9d7220a014f8b184"
dependencies = [
"bytes",
"curl",
diff --git a/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs b/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs
index df415212a..73604247a 100644
--- a/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs
+++ b/packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs
@@ -8,6 +8,7 @@ use time::OffsetDateTime;
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Display, EnumString)]
pub enum MediaType {
+ // Text
#[serde(rename = "text/plain")]
#[strum(to_string = "text/plain")]
TextPlain,
@@ -20,6 +21,11 @@ pub enum MediaType {
#[serde(rename = "text/csv")]
#[strum(to_string = "text/csv")]
TextCsv,
+ #[serde(rename = "text/xml")]
+ #[strum(to_string = "text/xml")]
+ TextXml,
+
+ // Application
#[serde(rename = "application/json")]
#[strum(to_string = "application/json")]
Json,
@@ -29,9 +35,6 @@ pub enum MediaType {
#[serde(rename = "application/xml")]
#[strum(to_string = "application/xml")]
Xml,
- #[serde(rename = "text/xml")]
- #[strum(to_string = "text/xml")]
- TextXml,
#[serde(rename = "application/x-www-form-urlencoded")]
#[strum(to_string = "application/x-www-form-urlencoded")]
FormUrlEncoded,
@@ -41,6 +44,83 @@ pub enum MediaType {
#[serde(rename = "application/octet-stream")]
#[strum(to_string = "application/octet-stream")]
OctetStream,
+ #[serde(rename = "application/pdf")]
+ #[strum(to_string = "application/pdf")]
+ ApplicationPdf,
+ #[serde(rename = "application/zip")]
+ #[strum(to_string = "application/zip")]
+ ApplicationZip,
+ #[serde(rename = "application/javascript")]
+ #[strum(to_string = "application/javascript")]
+ ApplicationJavascript,
+
+ // Audio
+ #[serde(rename = "audio/mpeg")]
+ #[strum(to_string = "audio/mpeg")]
+ AudioMpeg,
+ #[serde(rename = "audio/mp4")]
+ #[strum(to_string = "audio/mp4")]
+ AudioMp4,
+ #[serde(rename = "audio/x-m4a")]
+ #[strum(to_string = "audio/x-m4a")]
+ AudioXM4a,
+ #[serde(rename = "audio/wav")]
+ #[strum(to_string = "audio/wav")]
+ AudioWav,
+ #[serde(rename = "audio/ogg")]
+ #[strum(to_string = "audio/ogg")]
+ AudioOgg,
+ #[serde(rename = "audio/aac")]
+ #[strum(to_string = "audio/aac")]
+ AudioAac,
+ #[serde(rename = "audio/flac")]
+ #[strum(to_string = "audio/flac")]
+ AudioFlac,
+
+ // Video
+ #[serde(rename = "video/mp4")]
+ #[strum(to_string = "video/mp4")]
+ VideoMp4,
+ #[serde(rename = "video/avi")]
+ #[strum(to_string = "video/avi")]
+ VideoAvi,
+ #[serde(rename = "video/quicktime")]
+ #[strum(to_string = "video/quicktime")]
+ VideoQuicktime,
+ #[serde(rename = "video/x-msvideo")]
+ #[strum(to_string = "video/x-msvideo")]
+ VideoXMsvideo,
+ #[serde(rename = "video/webm")]
+ #[strum(to_string = "video/webm")]
+ VideoWebm,
+ #[serde(rename = "video/x-flv")]
+ #[strum(to_string = "video/x-flv")]
+ VideoXFlv,
+
+ // Image
+ #[serde(rename = "image/png")]
+ #[strum(to_string = "image/png")]
+ ImagePng,
+ #[serde(rename = "image/jpeg")]
+ #[strum(to_string = "image/jpeg")]
+ ImageJpeg,
+ #[serde(rename = "image/gif")]
+ #[strum(to_string = "image/gif")]
+ ImageGif,
+ #[serde(rename = "image/svg+xml")]
+ #[strum(to_string = "image/svg+xml")]
+ ImageSvgXml,
+ #[serde(rename = "image/webp")]
+ #[strum(to_string = "image/webp")]
+ ImageWebp,
+ #[serde(rename = "image/bmp")]
+ #[strum(to_string = "image/bmp")]
+ ImageBmp,
+ #[serde(rename = "image/x-icon")]
+ #[strum(to_string = "image/x-icon")]
+ ImageXIcon,
+
+ // Fallback for unknown
#[serde(other)]
Other,
}
diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock
index 3c53f963e..139218b32 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#dfa662f2e8a2731cd21c59b2a10bfc6e2ef70ca3"
+source = "git+https://github.com/CuriousCorrelation/relay.git#10aca0e5d74515a6fed231ee9d7220a014f8b184"
dependencies = [
"bytes",
"curl",
diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.lock b/packages/hoppscotch-desktop/src-tauri/Cargo.lock
index 6c06a5ab3..9c10b7849 100644
--- a/packages/hoppscotch-desktop/src-tauri/Cargo.lock
+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.lock
@@ -4319,7 +4319,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "relay"
version = "0.1.1"
-source = "git+https://github.com/CuriousCorrelation/relay.git#dfa662f2e8a2731cd21c59b2a10bfc6e2ef70ca3"
+source = "git+https://github.com/CuriousCorrelation/relay.git#10aca0e5d74515a6fed231ee9d7220a014f8b184"
dependencies = [
"bytes",
"curl",
@@ -5495,7 +5495,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-relay"
version = "0.1.0"
-source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay?rev=0147ac1bb29d3b88d6652432a482bd86f0174506#0147ac1bb29d3b88d6652432a482bd86f0174506"
+source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay?rev=4ed4fcafeb93856591e8a36522f6ec6e340e4dc5#4ed4fcafeb93856591e8a36522f6ec6e340e4dc5"
dependencies = [
"relay",
"serde",
diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.toml b/packages/hoppscotch-desktop/src-tauri/Cargo.toml
index 2e5040035..044bf9037 100644
--- a/packages/hoppscotch-desktop/src-tauri/Cargo.toml
+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.toml
@@ -30,7 +30,7 @@ tauri-plugin-dialog = "2.2.0"
tauri-plugin-fs = "2.2.0"
tauri-plugin-deep-link = "2.2.0"
tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "1b52e49d881926135838cf6cfebdc1643a9bec31" }
-tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "0147ac1bb29d3b88d6652432a482bd86f0174506" }
+tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "4ed4fcafeb93856591e8a36522f6ec6e340e4dc5" }
axum = "0.8.1"
tower-http = { version = "0.6.2", features = ["cors"] }
random-port = "0.1.1"
diff --git a/packages/hoppscotch-kernel/package.json b/packages/hoppscotch-kernel/package.json
index 0b439ee1d..11b091340 100644
--- a/packages/hoppscotch-kernel/package.json
+++ b/packages/hoppscotch-kernel/package.json
@@ -57,6 +57,6 @@
"@tauri-apps/plugin-dialog": "2.0.1",
"@tauri-apps/plugin-fs": "2.0.2",
"@tauri-apps/plugin-store": "2.2.0",
- "@hoppscotch/plugin-relay": "github:CuriousCorrelation/tauri-plugin-relay#0147ac1bb29d3b88d6652432a482bd86f0174506"
+ "@hoppscotch/plugin-relay": "github:CuriousCorrelation/tauri-plugin-relay#4ed4fcafeb93856591e8a36522f6ec6e340e4dc5"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 04ed9f051..6e0ec68b6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1236,8 +1236,8 @@ importers:
packages/hoppscotch-kernel:
dependencies:
'@hoppscotch/plugin-relay':
- specifier: github:CuriousCorrelation/tauri-plugin-relay#0147ac1bb29d3b88d6652432a482bd86f0174506
- version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/0147ac1bb29d3b88d6652432a482bd86f0174506'
+ specifier: github:CuriousCorrelation/tauri-plugin-relay#4ed4fcafeb93856591e8a36522f6ec6e340e4dc5
+ version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4ed4fcafeb93856591e8a36522f6ec6e340e4dc5'
'@tauri-apps/api':
specifier: 2.1.1
version: 2.1.1
@@ -1883,8 +1883,8 @@ packages:
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31}
version: 0.1.0
- '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/0147ac1bb29d3b88d6652432a482bd86f0174506':
- resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/0147ac1bb29d3b88d6652432a482bd86f0174506}
+ '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4ed4fcafeb93856591e8a36522f6ec6e340e4dc5':
+ resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4ed4fcafeb93856591e8a36522f6ec6e340e4dc5}
version: 0.1.0
@@ -14878,7 +14878,7 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.1.1
- '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/0147ac1bb29d3b88d6652432a482bd86f0174506':
+ '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4ed4fcafeb93856591e8a36522f6ec6e340e4dc5':
dependencies:
'@tauri-apps/api': 2.1.1