Websocket Support (#159)

This commit is contained in:
Gregory Schier
2025-01-31 09:00:11 -08:00
committed by GitHub
parent d411713502
commit c8be8082c5
122 changed files with 5090 additions and 616 deletions

View File

@@ -1,9 +1,9 @@
import type { AnyModel, GrpcRequest, HttpRequest } from '@yaakapp-internal/models';
import type { AnyModel } from '@yaakapp-internal/models';
export function fallbackRequestName(r: HttpRequest | GrpcRequest | AnyModel | null): string {
export function fallbackRequestName(r: AnyModel | null): string {
if (r == null) return '';
if (r.model !== 'grpc_request' && r.model !== 'http_request') {
if (!('url' in r) || r.model === 'plugin') {
return 'name' in r ? r.name : '';
}
@@ -15,7 +15,11 @@ export function fallbackRequestName(r: HttpRequest | GrpcRequest | AnyModel | nu
// Replace variable syntax with variable name
const withoutVariables = r.url.replace(/\$\{\[\s*([^\]\s]+)\s*]}/g, '$1');
if (withoutVariables.trim() === '') {
return r.model === 'http_request' ? 'New HTTP Request' : 'new gRPC Request';
return r.model === 'http_request'
? 'HTTP Request'
: r.model === 'websocket_request'
? 'WebSocket Request'
: 'gRPC Request';
}
// GRPC gets nice short names