@placeos/ts-client 4.2.6 → 4.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/http/mock.ts +3 -3
package/package.json
CHANGED
package/src/http/mock.ts
CHANGED
|
@@ -51,7 +51,7 @@ export function registerMockEndpoint<T>(
|
|
|
51
51
|
deregisterMockEndpoint(handler_ops.method, handler_ops.path, handler_map);
|
|
52
52
|
const key = `${handler_ops.method}|${handler_ops.path}`;
|
|
53
53
|
const path_parts = handler_ops.path
|
|
54
|
-
.replace(/(http|https):\/\/[a-zA-Z0-9
|
|
54
|
+
.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g, '') // Remove URL origin
|
|
55
55
|
.replace(/^\//, '')
|
|
56
56
|
.split('/');
|
|
57
57
|
const handler: MockHttpRequestHandler<T> = {
|
|
@@ -135,7 +135,7 @@ export function findRequestHandler(
|
|
|
135
135
|
handler_map: HashMap<MockHttpRequestHandler> = _handlers,
|
|
136
136
|
): MockHttpRequestHandler | null {
|
|
137
137
|
const path = url
|
|
138
|
-
.replace(/(http|https):\/\/[a-zA-Z0-9
|
|
138
|
+
.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g, '')
|
|
139
139
|
.replace(/^\//, '')
|
|
140
140
|
.split('?')[0];
|
|
141
141
|
const route_parts = path.split('/');
|
|
@@ -181,7 +181,7 @@ export function processRequest<T = any>(
|
|
|
181
181
|
body?: any,
|
|
182
182
|
): MockHttpRequest {
|
|
183
183
|
const parts = url
|
|
184
|
-
.replace(/(http|https):\/\/[a-zA-Z0-9
|
|
184
|
+
.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g, '')
|
|
185
185
|
.split('?');
|
|
186
186
|
const path = parts[0].replace(/^\//, '');
|
|
187
187
|
const query = parts[1] || '';
|