@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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.2.6",
2
+ "version": "4.2.7",
3
3
  "license": "MIT",
4
4
  "name": "@placeos/ts-client",
5
5
  "author": "Alex Sorafumo <alex@place.tech>",
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.]*:?([0-9]*)?/g, '') // Remove URL origin
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.]*:?([0-9]*)?/g, '')
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.]*:?([0-9]*)?/g, '')
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] || '';