fix(core_node): Fix unix socket URL parsing and handling in CoreRequest
This commit is contained in:
@@ -17,10 +17,22 @@ export abstract class CoreRequest<
|
||||
|
||||
/**
|
||||
* Parses socket path and route from unix socket URL
|
||||
* Handles both full URLs (http://unix:/path/to/socket:/route) and pre-stripped paths (unix:/path/to/socket:/route)
|
||||
*/
|
||||
static parseUnixSocketUrl(url: string): { socketPath: string; path: string } {
|
||||
// Strip http:// or https:// prefix if present
|
||||
// This makes the method work with both full URLs and pre-stripped paths
|
||||
let cleanUrl = url;
|
||||
if (cleanUrl.startsWith('http://')) {
|
||||
cleanUrl = cleanUrl.substring('http://'.length);
|
||||
} else if (cleanUrl.startsWith('https://')) {
|
||||
cleanUrl = cleanUrl.substring('https://'.length);
|
||||
}
|
||||
|
||||
// Parse the socket path and HTTP path
|
||||
// Format: unix:/path/to/socket:/route/path
|
||||
const parseRegex = /(.*):(.*)/;
|
||||
const result = parseRegex.exec(url);
|
||||
const result = parseRegex.exec(cleanUrl);
|
||||
return {
|
||||
socketPath: result[1],
|
||||
path: result[2],
|
||||
|
||||
Reference in New Issue
Block a user