mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 23:31:21 +02:00
Merge main into turchinc/main (PR #324)
This commit is contained in:
@@ -13,7 +13,7 @@ export function languageFromContentType(
|
||||
return 'xml';
|
||||
}
|
||||
if (justContentType.includes('html')) {
|
||||
const detected = detectFromContent(content);
|
||||
const detected = languageFromContent(content);
|
||||
if (detected === 'xml') {
|
||||
// If it's detected as XML, but is already HTML, don't change it
|
||||
return 'html';
|
||||
@@ -22,16 +22,16 @@ export function languageFromContentType(
|
||||
}
|
||||
if (justContentType.includes('javascript')) {
|
||||
// Sometimes `application/javascript` returns JSON, so try detecting that
|
||||
return detectFromContent(content, 'javascript');
|
||||
return languageFromContent(content, 'javascript');
|
||||
}
|
||||
if (justContentType.includes('markdown')) {
|
||||
return 'markdown';
|
||||
}
|
||||
|
||||
return detectFromContent(content, 'text');
|
||||
return languageFromContent(content, 'text');
|
||||
}
|
||||
|
||||
function detectFromContent(
|
||||
export function languageFromContent(
|
||||
content: string | null,
|
||||
fallback?: EditorProps['language'],
|
||||
): EditorProps['language'] {
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const encodings = ['*', 'gzip', 'compress', 'deflate', 'br', 'identity'];
|
||||
export const encodings = ['*', 'gzip', 'compress', 'deflate', 'br', 'zstd', 'identity'];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { readFile } from '@tauri-apps/plugin-fs';
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import type { FilterResponse } from '@yaakapp-internal/plugins';
|
||||
import type { ServerSentEvent } from '@yaakapp-internal/sse';
|
||||
@@ -30,3 +31,10 @@ export async function getResponseBodyEventSource(
|
||||
filePath: response.bodyPath,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getResponseBodyBytes(
|
||||
response: HttpResponse,
|
||||
): Promise<Uint8Array<ArrayBuffer> | null> {
|
||||
if (!response.bodyPath) return null;
|
||||
return readFile(response.bodyPath);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ type TauriCmd =
|
||||
| 'cmd_format_json'
|
||||
| 'cmd_get_http_authentication_config'
|
||||
| 'cmd_get_http_authentication_summaries'
|
||||
| 'cmd_get_http_response_events'
|
||||
| 'cmd_get_sse_events'
|
||||
| 'cmd_get_themes'
|
||||
| 'cmd_get_workspace_meta'
|
||||
@@ -26,6 +27,7 @@ type TauriCmd =
|
||||
| 'cmd_grpc_request_actions'
|
||||
| 'cmd_http_request_actions'
|
||||
| 'cmd_http_collection_actions'
|
||||
| 'cmd_http_request_body'
|
||||
| 'cmd_http_response_body'
|
||||
| 'cmd_import_data'
|
||||
| 'cmd_install_plugin'
|
||||
|
||||
Reference in New Issue
Block a user