@placeos/ts-client 4.2.5 → 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/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { del, get, patch, post, put, responseHeaders } from './http/functions';
2
2
  export type { HttpError, HttpJsonOptions, HttpOptions, HttpResponse, HttpResponseType, MockHttpRequest, MockHttpRequestHandler, MockHttpRequestHandlerOptions, } from './http/interfaces';
3
- export { deregisterMockEndpoint, registerMockEndpoint } from './http/mock';
3
+ export { deregisterMockEndpoint, registerMockEndpoint, setMockNotFoundHandler, } from './http/mock';
4
4
  export { PlaceApplication } from './applications/application';
5
5
  export { addApplication, queryApplications, removeApplication, showApplication, updateApplication, } from './applications/functions';
6
6
  export type { PlaceApplicationQueryOptions } from './applications/interfaces';
@@ -1,6 +1,12 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { HashMap } from '../utilities/types';
3
3
  import { HttpVerb, MockHttpRequest, MockHttpRequestHandler, MockHttpRequestHandlerOptions } from './interfaces';
4
+ /**
5
+ * Change the handler for not found endpoints
6
+ * Return `null` if you want to make the real request
7
+ * @param handler_fn Function to handle not found mocked endpoints
8
+ */
9
+ export declare function setMockNotFoundHandler(handler_fn: (method: HttpVerb, url: string) => Observable<never> | null): void;
4
10
  /**
5
11
  * Register handler for http endpoint
6
12
  * @param path URL to be handled
@@ -26,7 +32,7 @@ export declare function clearMockEndpoints(handler_map?: HashMap<MockHttpRequest
26
32
  /**
27
33
  * @private
28
34
  * Perform mock request for the given method and URL.
29
- * Returns `null` if no handler for URL and method
35
+ * Returns a 404 error if no handler for URL and method
30
36
  * @param method Http Verb for request
31
37
  * @param url URL to perform request on
32
38
  * @param handler_map Handler map to query for the request handler.